RE: [PHP] can't make str_replace work with single quote
Try str_replace(chr(39),.. -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Monday, March 24, 2003 2:23 PM To: DomIntCom Cc: [EMAIL PROTECTED] Subject: Re: [PHP] can't make str_replace work with single quote works for me: echo str_replace('2003','2002', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); DomIntCom wrote: >this should be pretty straight forward, but I cannot make this work for some >reason. > >$ndate = str_replace("'",'', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); > >to extrapolate we have the following string surrounded by double quotes; >'2003-1;1 00:00:01' AND '2003-3-1 23:59:59' > >now - I have even tried the following command and the replace would not take >place; > >str_replace('2003','2002', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); > >the search & replace would not work. I've tried ereg_replace and >preg_replace, and I get the same results. > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't make str_replace work with single quote
yea - that figures... I was pretty certain I had the syntax correct. this is kind of a round about way, but I finally did get the following to work; $ndate = strtr($date, "'" , "\\"); $ndate = stripslashes($ndate); "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > works for me: > echo str_replace('2003','2002', "'2003-1;1 00:00:01' AND '2003-3-1 > 23:59:59'"); > > DomIntCom wrote: > > >this should be pretty straight forward, but I cannot make this work for some > >reason. > > > >$ndate = str_replace("'",'', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); > > > >to extrapolate we have the following string surrounded by double quotes; > >'2003-1;1 00:00:01' AND '2003-3-1 23:59:59' > > > >now - I have even tried the following command and the replace would not take > >place; > > > >str_replace('2003','2002', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); > > > >the search & replace would not work. I've tried ereg_replace and > >preg_replace, and I get the same results. > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can't make str_replace work with single quote
works for me: echo str_replace('2003','2002', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); DomIntCom wrote: this should be pretty straight forward, but I cannot make this work for some reason. $ndate = str_replace("'",'', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); to extrapolate we have the following string surrounded by double quotes; '2003-1;1 00:00:01' AND '2003-3-1 23:59:59' now - I have even tried the following command and the replace would not take place; str_replace('2003','2002', "'2003-1;1 00:00:01' AND '2003-3-1 23:59:59'"); the search & replace would not work. I've tried ereg_replace and preg_replace, and I get the same results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php