Source Code:
(back to article)
<?php function createUrlSlug($urlString) { $slug = preg_replace('/[^A-Za-z0-9-]+/', '-', $urlString); return $slug; } echo createUrlSlug('this is the example demo page'); // This will return 'this-is-the-example-demo-page' ?>
Result:
Report an issue