Return to Snippet

Revision: 44301
at April 9, 2011 07:37 by abelperez


Initial Code
function getSeoVersion($phrase) {
  return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($phrase))));
}

// example usage:
echo getSeoVersion("German cars are amazing.");

Initial URL
http://abel-perez.com

Initial Description
Useful function for taking the title of an Article or keyword phrase and converting it into an SEO friendly version that can be used in a URL.  For example, the title "German Cars are amazing" would be transformed into "german-cars-are-amazing".

Initial Title
Convert phrase into SEO friendly version

Initial Tags
php

Initial Language
PHP