FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Need help with updating ereg_replace function -> to preg_replace
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Need help with updating ereg_replace function -> to preg_replace [message #180592 is a reply to message #180585] Mon, 04 March 2013 10:39 Go to previous messageGo to previous message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma:
Senior Member
On Mar 1, 3:24 pm, da...@allheller.net wrote:
> On Friday, March 1, 2013 8:10:07 AM UTC-5, da...@allheller.net wrote:
>> Hello
>
>> I'm totally confused none of the examples I've googled seem to help with fixing the following line of code:
>
>> $myfunc = ereg_replace("0+$", "", $data);
>
>> I've tried $myfunc = preg_replace("/0+$/", "/", $data);
>
>> Please any help would be appreciated as I did not write this code and really still trying to figure out regex functions.
>
>> Thanks,
>
>> Dave
>
> Thanks for all the help. "str_replace" works as a direct drop in replacement for "ereg_replace"

It is no where near a direct drop replacement. What the ereg above
does is to remove trailing zeros (the $ sign means the end of the
line, it is not a literal $). Your str_replace will not do anything
like that.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Other source for help?
Next Topic: returning values from a 2d array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 01:40:32 GMT 2024

Total time taken to generate the page: 0.05182 seconds