Page 1 of 1

transform and convert characters

Posted: Wed Nov 18, 2009 5:02 pm
by yacahuma
What can I do to compare Catano with Cataño so that they are the same. I tried different methods to convert the characters but they dont seem to work. For example:

Code: Select all

 
  function translate($string)
    {
        $accented =array('ñ','á','ú','í','é','ó');
        $replace =array('n','a','u','i','e','o');
return str_replace($accented, $replace, $string);        
        
    }        
 
I am using utf-8 in my pages and database

thank you

Re: transform and convert characters

Posted: Wed Nov 18, 2009 5:20 pm
by Jonah Bron
Maybe try using ord('ñ') in that array instead?