|
Posted by larry on 09/30/28 11:55
"Alvaro G. Vicario" <webmaster@NOSPAMdemogracia.com> a crit dans le message
de news: 1qsioqa49tj44$.1kt5d9ixv11br$.dlg@40tude.net...
> *** larry escribi/wrote (Fri, 11 Aug 2006 08:25:39 +0200):
>> I'd like to convert this kind of character :
>>
>> #48;
>>
>> into a human readable character :
>>
>> 0
>
> Two suggestions:
>
>
> <?
>
> $foo='This tring has some chars like #48;, #120; or #64;';
>
>
> echo preg_replace('/#(\d+);/e', 'chr($1)', $foo);
>
>
> function char_from_code($foo){
> return chr($foo[1]);
> }
> echo preg_replace_callback('/#(\d+);/', 'char_from_code', $foo);
>
> ?>
>
>
> Yep, I know you probably didn't mean this ;-)
>
>
> --
> -+ http://alvaro.es - lvaro G. Vicario - Burgos, Spain
> ++ Mi sitio sobre programacin web: http://bits.demogracia.com
> +- Mi web de humor con rayos UVA: http://www.demogracia.com
> --
thank you all for your answers.
--
larry
Navigation:
[Reply to this message]
|