GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php quick question (https://gfy.com/showthread.php?t=789850)

alex79 12-05-2007 02:35 PM

php quick question
 
i'm trying to replace the character "?" with "-" from $string using

$result=eregi_replace("?","-",$string");

but the result is a null array..
what i'm doing wrong?

thanks

DigitalPimp 12-05-2007 02:40 PM

don't need the last quote, also try str_replace instead

alex79 12-05-2007 02:42 PM

Quote:

Originally Posted by DigitalPimp (Post 13475114)
don't need the last quote

yes.. without last quote.. but how do i "escape" the ? character?

Bro Media - BANNED FOR LIFE 12-05-2007 02:43 PM

$result = str_replace("?", "-", $string);

alex79 12-05-2007 02:47 PM

Quote:

Originally Posted by Jaysin (Post 13475119)
$result = str_replace("?", "-", $string);

this is working..thank you

DigitalPimp 12-05-2007 02:48 PM

for future reference, you can escape characters with special meaning like a ? by putting a \ before them but when you use str_replace instead of eregi_replace it will not give special meaning to the ? so you don't need to escape it.


All times are GMT -7. The time now is 11:33 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123