I have a mysql table that 开发者_开发百科contains words joined by underscores and also words joined by hyphens.
example: Engineering-Service_Civil-Geotech
I am able to replace the underscore with an ampersand and add a space on either side, but im stuck at how to replace the hyphen with one blank space as well.
$cleanCat = str_replace( '_', ' & ', $Cat);
echo $cleanCat;
The result of the above code gives me one solution but not both:
example: Engineering-Service & Civil-Geotech
Do i have to use a different command to achieve this?
thanks in advance.
$cleanCat = str_replace('-', ' ', str_replace( '_', ' & ', $Cat));
str_replace( '-', ' ', $Cat); or str_replace( '-', ' ', $Cat);
should work
精彩评论