/ Published in: PHP
URL: http://www.milesj.me/blog/read/15/5-custom-basic-php-string-functions
Esta versión, a diferencia de mi otra función reemplaza las vocales acentuadas y otros caracteres
Expand |
Embed | Plain Text
/** * Rewrite strings to be URL/SEO friendly * @param string $text * @return string */ function slugify($text) { // Map thanks to CakePHP '/à |á|Ã¥|â/' => 'a', '/è|é|ê|?|ë/' => 'e', '/ì|Ã|î/' => 'i', '/ò|ó|ô|ø/' => 'o', '/ù|ú|?|û/' => 'u', '/ç/' => 'c', '/ñ/' => 'n', '/ä|æ/' => 'ae', '/ö/' => 'oe', '/ü/' => 'ue', '/Ã�/' => 'Ae', '/Ã�/' => 'Ue', '/Ã�/' => 'Oe', '/Ã�/' => 'ss', '/[^\w\s]/' => ' ', ); return $text; }
You need to login to post a comment.
