Create a URL from a string of text with PHP like wordpress
<?php
function create_slug($string){
$string = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $string );
$string = strtolower($string);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $slug;
}
$slug = create_slug('This is my page title');
echo $slug;
// this should print out: this-is-my-page-title
?>