- preg_replace: documentation ( source)
- strtolower: documentation ( source)
<?php
$temp = "hello there-----------how are you--au$!@&*";
$temp = strtolower($temp);
$temp = preg_replace('/\s+/','-', $temp);
$temp = preg_replace('/\W+/', '', $temp);
echo($temp);