Create clean and SEO friendly URL slug using PHP

By using this PHP code snippet you can create clean and SEO friendly URL slug from post title.


									<?php

function Slug($str) {
	return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', trim($str)), "-"));
}

// Example:
echo Slug("Hello, can you hear me?"); //output: hello-can-you-hear-me

?>
								

binary.artist

There are only 10 types of people in the world, those who understand binary and those who don't.

Comments (0)

No Comments Yet.