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 #180583 is a reply to message #180582] Fri, 01 March 2013 14:00 Go to previous messageGo to previous message
Michael Vilain is currently offline  Michael Vilain
Messages: 88
Registered: September 2010
Karma:
Member
In article <fbab9879-db62-4cef-80e9-71a2c0d4aecd(at)googlegroups(dot)com>,
daveh(at)allheller(dot)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

Where have you looked to try to find the function descriptions for the
php replace functions?

From php.org, there's a big warning not to use ereg_replace because it's
deprecated in php 5.3. It uses the POSIX regex pattern matching style
to do the string matching and replace.

http://www.php.net/manual/en/function.ereg-replace.php

preg_replace uses the PERL string matching symantics which is slightly
different from POSIX. It's also more robust, but it used to be slower
than the ereg functions but that might not be the case any more.

http://www.php.net/manual/en/function.preg-replace.php

What part of this is confusing you?

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
[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: Fri Nov 22 05:32:38 GMT 2024

Total time taken to generate the page: 0.03830 seconds