advanced code snippet search
wellynz on 09/08/10
url php html ascii clean cleaner
09/08/10 12:08pm09/08/10 12:07pm
function toAscii($str, $replace=array(), $delimiter='-') { if( !empty($replace) ) { $str = str_replace((array)$replace, ' ', $str); } $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str); $clean = preg_replace("/[^a-zA-Z0-9/_|+ -]/", '', $clean); $clean = strtolower(trim($clean, '-')); $clean = preg_replace("/[/_|+ -]+/", $delimiter, $clean); return $clean;}
Report this snippet Tweet
Comment:
You need to login to post a comment.