fork(1) download
  1. <?php
  2.  
  3. function url($string) {
  4. $entrada = array( 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','X','Z','W','Y','ä','ã','à','á','â','ê','ë','è','é','ï','ì','í','ö','õ','ò','ó','ô','ü','ù','ú','û','À','Á','É','Í','Ó','Ú','ñ','Ñ','ç','Ç',' ','-','(',')',',',';',':','|','!','"','#','$','%','&','/','=','?','~','^','>','<','ª','º','.','+' );
  5. $saida = array( 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','x','z','w','y','a','a','a','a','a','e','e','e','e','i','i','i','o','o','o','o','o','u','u','u','u','a','a','e','i','o','u','n','n','c','c','-','-','','','','','','','','','','','','','','','','','','','','','','','' );
  6. return str_replace($entrada, $saida, $string);
  7. }
  8.  
  9.  
  10. $str = "This is a test url - hyphen problem. When there is space before a character.";
  11.  
  12. echo url($str);
Success #stdin #stdout 0.02s 24264KB
stdin
Standard input is empty
stdout
this-is-a-test-url---hyphen-problem-when-there-is-space-before-a-character