/ Published in: PHP
Convert space to dash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function url_title($str, $separator = '-', $lowercase = FALSE) { if ($separator === 'dash') { $separator = '-'; } elseif ($separator === 'underscore') { $separator = '_'; } '&.+?;' => '', '[^\w\d _-]' => '', '\s+' => $separator, '('.$q_separator.')+' => $separator ); foreach ($trans as $key => $val) { } if ($lowercase === TRUE) { } }