Does php have a built-in string function that converts underscores into spaces?
Not a function that specially only does that task. However to accomplish that goal is simple.
All you need to do is use the function "str_replace", its can be used like this:
$newstring = str_replace("_"," ",$oldstring);
The function "str_replace" takes three arguments:
- First is what you want to search for, and be replaced. It is called the "needle".
- Secondly is the replacement, which is used to replace the needle when it is found.
- Lastly you supply the "haystack", or the string in which you wish to find the needle(s).
0 comments:
Post a Comment