seo friendly url using slug

function makemeslug($data=""){

if($data){

$data = trim(strtolower($data)); 

$search = array('/','\\',':',';','!','@','#','$','%','^','*','(',')','_','+','=','|','{','}','[',']','"',"'",'<','>',',','?','~','`','&','.');

$ds  = str_replace($search," ",$data);

$ds2 = preg_replace('/\s+/',' ',$ds);

$slug = trim($ds2);

$slug = str_replace(" ","-",$slug);

return $slug;

}else{

return $data;

}

}

$data = "making of slug friendz";
$seourl = function makemeslug($data);

$result:: making-of-slug-friendz.
Please follow and like us: