I found a few interesting solutions throughout the web.. note none of this is my code. Simply copied here in hopes of helping you build a custom function for your own app.
This has been copied from Chyrp. Should work well for your needs!
/** * Function: sanitize * Returns a sanitized string, typically for URLs. * * Parameters: * $string - The string to sanitize. * $force_lowercase - Force the string to lowercase? * $anal - If set to *true*, will remove all non-alphanumeric characters. */function sanitize($string, $force_lowercase = true, $anal = false) {$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]","}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—","—", "–", ",", "<", ".", ">", "/", "?");$clean = trim(str_replace($strip, "", strip_tags($string)));$clean = preg_replace('/\s+/', "-", $clean);$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ;return ($force_lowercase) ? (function_exists('mb_strtolower')) ? mb_strtolower($clean, 'UTF-8') : strtolower($clean) : $clean;}
EDIT:Even easier function I found! Just a few lines of code, fairly self-explanitory.
function slug($z){ $z = strtolower($z); $z = preg_replace('/[^a-z0-9 -]+/', '', $z); $z = str_replace('', '-', $z); return trim($z, '-');}