/ Published in: PHP
                    
                                        
Esta versión, a diferencia de mi otra función reemplaza las vocales acentuadas y otros caracteres
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
/**
* 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;
}
URL: http://www.milesj.me/blog/read/15/5-custom-basic-php-string-functions
Comments
 Subscribe to comments
                    Subscribe to comments
                
                