PHP Snippet: Create Post Slugs:
Create user friendly post slugs from title string to use within URLs.
<?php function create_slug($string) { $slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string); return $slug; } ?>