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 "&"(HTML encoded). How can I get
the replacement to be an ampersand itself?

My code:
/**
 *      From client comens all special characters encoded
 *      HTML encoded but instead of &#NUMBER; => _#NUMBER;
 *      This Method restores to &#NUMBER;
**/
function restoreHTMLEcodedCharacters(&$pArray){
        $amp = '&';
        foreach($pArray as $key => $value){
                if(is_array($value)){
                        restoreHTMLEcodedCharacters($value);
                }else{
                        //debugger::log($value);
                        $value = preg_replace("_#", "&#", $value);
                        $value = str_replace("&", "&", $value);
                }
        }
        return $pArray;
}

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to