|
Posted by Brandon Rohde on 12/02/01 11:29
$my_string = "United_Kingdom";
$my_new_string = str_replace("_", " ", $my_string);
echo "$my_new_string"; //this will output United Kingdom
When you use str_replace(), you need to give it 3 elements. The first is the
character you want to replace, the second is the character to replace it
with, and the third is the string you want to modify.
You can find more info on it at www.php.net/str_replace
--
-Brandon Rohde
"VS" <vs@nospam.blueyonder.invalid> wrote in message
news:b%q4f.35616$U9.15574@fe3.news.blueyonder.co.uk...
> Hi,
>
> I'm new to PHP, I'm having trouble finding a way to replace a '_' in a
> string with a space.
>
> i.e using 'eregi_replace' I want to change
>
> 'United_Kingdom' to
>
> 'United Kingdom'
>
> --
> VS
Navigation:
[Reply to this message]
|