Created
March 17, 2012 16:09
-
-
Save lleitep3/2061549 to your computer and use it in GitHub Desktop.
ascii2entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// encontrada nesse link | |
// http://www.php.net/manual/en/function.htmlentities.php | |
function ascii2entities($string){ | |
for($i=128;$i<=255;$i++){ | |
$entity = htmlentities(chr($i), ENT_QUOTES, 'cp1252'); | |
$temp = substr($entity, 0, 1); | |
$temp .= substr($entity, -1, 1); | |
if ($temp != '&;'){ | |
$string = str_replace(chr($i), '', $string); | |
} | |
else{ | |
$string = str_replace(chr($i), $entity, $string); | |
} | |
} | |
return $string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment