Replace Dash with Space in PHP

This str_replace does the job:

$string = str_replace("-", " ", $string);

Also, you can make it as a function.

function replace_dashes($string) {
    $string = str_replace("-", " ", $string);
    return $string;
}

Then you call it:

$varcity = replace_dashes($row[website]);
<div><a href="http://www.envisionforce.com/local/'.$row[website].'-seo-services">'.ucwords($varcity).'</a></div>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)