title: comparing string with accents in php
body: <p>I'm having problems when comparing two strings which contains accents.
  This is my case:</p>
  
  <p><strong>The first string is: Master</strong> 
  <strong>The second string is: Máster Diseño Producción</strong></p>
  
  <p>Then, I need to remove the word <strong>Máster</strong> from the second string, because it's contained in the first string.</p>
  
  <p>I have created a function for clean each string:</p>
  
  <pre><code>function sanear_string($cadena)
  {
      $cadena = trim($cadena);
  
      $cadena = str_replace(
          array('á', 'à', 'ä', 'â', 'ª', 'Á', 'À', 'Â', 'Ä'),
          array('a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A'),
          $cadena
      );
  
      $cadena = str_replace(
          array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ê', 'Ë'),
          array('e', 'e', 'e', 'e', 'E', 'E', 'E', 'E'),
          $cadena
      );
  
      $cadena = str_replace(
          array('í', 'ì', 'ï', 'î', 'Í', 'Ì', 'Ï', 'Î'),
          array('i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'),
          $cadena
      );
  
      $cadena = str_replace(
          array('ó', 'ò', 'ö', 'ô', 'Ó', 'Ò', 'Ö', 'Ô'),
          array('o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'),
          $cadena
      );
  
      $cadena = str_replace(
          array('ú', 'ù', 'ü', 'û', 'Ú', 'Ù', 'Û', 'Ü'),
          array('u', 'u', 'u', 'u', 'U', 'U', 'U', 'U'),
          $cadena
      );
  
      $cadena = str_replace(
          array('ñ', 'Ñ', 'ç', 'Ç'),
          array('n', 'N', 'c', 'C',),
          $cadena
      );
  
      //Esta parte se encarga de eliminar cualquier caracter extraño
      $cadena = str_replace(
          array("\\", "¨", "º", "-", "~",
              "#", "@", "|", "!", "\"",
              "·", "$", "%", "&amp;", "/",
              "(", ")", "?", "'", "¡",
              "¿", "[", "^", "`", "]",
              "+", "}", "{", "¨", "´",
              "&gt;", "&lt;", ";", ",", ":",
              ".", " "),
          '',
          $cadena
      );
  
  
      return $cadena;
  }
  </code></pre>
  
  <p>And it helps me to the problem of accents. Now I can use strpos to compare both strings...if result is > 0 then I know that the word is contained... but I need some help more....
  Thanks in advance,</p>