Page 1 of 1

Can't replace + with ereg_replace

Posted: Thu May 13, 2004 2:57 am
by dimitris
in order to pass names from page to page via get but i have problems!

I succeded running first this code:
їcode]$loc=ereg_replace(" ","+",$loc);ї/code]
but when i use
їcode]$plus='+';
$loc=ereg_replace($plus, " ",$loc);ї/code]
or

$loc=ereg_replace("+", " ",$loc);

i get this error:
Warning: Invalid preceding regular expression in /home/greeceqt.com/www/locations_islands.php on line 15

What is wrong?I guess that the problem is + which may be confused with its operator ability!

Posted: Thu May 13, 2004 3:18 am
by Wayne
try

Code: Select all

$loc=ereg_replace("\+", " ",$loc);

Posted: Thu May 13, 2004 3:25 am
by dimitris
Wayne wrote:try

Code: Select all

$loc=ereg_replace("\+", " ",$loc);
OK it worked! I also found that

Code: Select all

$loc=str_replace("+", " ",$loc);
works too!