note 77910 deleted from function.chr by nlopess
| From: | nlopess@php.net | Date: | Wed, 19 Sep 2007 21:43:10 +0000 |
| Subject: | note 77910 deleted from function.chr by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130610@lists.php.net to get a copy of this message | ||
Note Submitter: saintienn at gmail dot com
Reason: non-english
----
#######################################
função que converte caracteres asc de html em caracter normal usando chr() e preg_replace()
ex de conversão: s é convetido para o caracter 's'
function convert_ASC_entities ($str){
$tasc=array();
$tch=array();
for($i=33;$i<=256;$i++){
$tasc[$i-33]="/&#".$i."/";
$tch[$i-33]=chr($i);
}
return preg_replace($tasc, $tch, $str);
}
#########################################
função que converte caracter normal em caracteres asc de html usando chr() e preg_replace()
ex de conversão: o caracter 's' é convetido para s
function unconvert_ASC_entities ($str){
$tasc=array();
$tch=array();
for($i=33;$i<=256;$i++){
$tasc[$i-33]="/&#".$i."/";
$tch[$i-33]=chr($i);
}
return preg_replace($tch,$tasc, $str);
}
#########################################