Did you try any another function? For example:
http://de3.php.net/strtr



On 2 Mai, 09:29, rartavia <[email protected]> wrote:
> Hello, i'm trying to make a replace of a character in a string for an
> '&'. I tried several ways of replacement but (cake)PHP, when I do
> str_replace("_", "&") it returns "&amp;"(HTML encoded). How can I get
> the replacement to be an ampersand itself?
>
> My code:
> /**
>  *      From client comes all special characters encoded
>  *      HTML encoded but instead of &#NUMBER; => _#NUMBER;
>  *      This Method restores to &#NUMBER;
> **/
> function restoreHTMLEcodedCharacters(&$pArray){
>         foreach($pArray as $key => $value){
>                 if(is_array($value)){
>                         restoreHTMLEcodedCharacters($value);
>                 }else{
>                         //debugger::log($value);
>                         $value = preg_replace("_#", "&#", $value);
>                         $value = str_replace("&#38;", "&", $value);
>                 }
>         }
>
> }
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to