To covert a string to SEO friendly, do this:
<?php
$realname = "This is the string to be made SEO friendly!"
$seoname = preg_replace('/\%/',' percentage',$realname);
$seoname = preg_replace('/\@/',' at ',$seoname);
$seoname = preg_replace('/\&/',' and ',$seoname);
$seoname = preg_replace('/\s[\s]+/','-',$seoname); $seoname = preg_replace('/[\s\W]+/','-',$seoname); $seoname = preg_replace('/^[\-]+/','',$seoname); $seoname = preg_replace('/[\-]+$/','',$seoname); $seoname = strtolower($seoname);
echo $seoname;
?>
This will print: this-is-the-string-to-be-made-seo-friendly