3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php static public function slugify($text) { // replace non letter or digits by - $text = preg_replace('~[^\\pL\d]+~u', '-', $text); // trim $text = trim($text, '-'); // transliterate $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); // lowercase $text = strtolower($text); // remove unwanted characters $text = preg_replace('~[^-\w]+~', '', $text); if (empty($text)) { return 'n-a'; } return $text; } $string = "andrés EFI收购Cretaprint"; echo slugify($string);
Output for 5.4.0 - 5.4.15
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /in/M0hcp on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.25
Parse error: syntax error, unexpected T_PUBLIC, expecting T_PAAMAYIM_NEKUDOTAYIM in /in/M0hcp on line 3
Process exited with code 255.