PDA

View Full Version : replacing space with +


redhead
12-10-2002, 08:56 PM
hello

sorry to ask such simple questions...:( ive taken a look at str_replace() (http://www.php.net/manual/en/function.str-replace.php) but that manual could as well be written in swaheli...

i need to change a space with a "+" sign in a variable... is this wrong?str_replace(" ", "+", $var)thanks guys...

usban
12-10-2002, 10:10 PM
This script is corretc.

The function str_replace has theree parameters.

The first one is yhe character you want to remove.
The second is the new character you want to put.
The third is the variable or string in which you want to do the changes.

I think with this, you should not have any other problem using this function.
:thumbsup:

Spookster
12-10-2002, 10:26 PM
Don't forget you need to assign the changes back to your variable:



$var = str_replace(" ", "+", $var);

redhead
12-11-2002, 08:10 PM
thanks guys... your help is much appreciated.