Browsing the archives for the PHP category.

strtoslug() – SEO Friendly URL’s with PHP

PHP

Quick n’ Simple.  Check it:

function strtoslug($str) {
	$str = strtolower(trim($str));
	$str = preg_replace('/[^a-z0-9-]/', '-', $str);
	$str = preg_replace('/-+/', "-", $str);
	return $str;
}
No Comments