Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php replace all spaces with dashes

// Clean up multiple dashes or whitespaces
$string = preg_replace("/[s-]+/", " ", $string);
// Convert whitespaces and underscore to dash
$string = preg_replace("/[s_]/", "-", $string);
 
PREVIOUS NEXT
Tagged: #php #replace #spaces #dashes
ADD COMMENT
Topic
Name
4+7 =