Re: Executing functions within ereg_replace() output
| From: | Adam Wan | Date: | Sun, 07 Apr 2002 10:26:29 +0000 |
| Subject: | Re: Executing functions within ereg_replace() output | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91916@lists.php.net to get a copy of this message | ||
Thanks! That preg_replace_callback helps alot.
-Adam
"Cc Zona" <email@cczona.com> wrote in message
news:email-264951.16303606042002@pb1.pair.com...
> In article <20020406131252.82440.qmail@pb1.pair.com>,
> adam@wangallery.com (Adam Wan) wrote:
>
> > $content = 'string string 12463409834234 string string';
> > $content = ereg_replace( "[0-9]{14}" , substr("\\1",0,5) , $content );
> >
> > // this is the output i want, but the above doesnt seem to be the right
way
> > to generate it.
> >
> > string string 12363 string string
> > --------------------
> >
> > any ideas?
>
> For future reference:
> <http://www.php.net/preg-replace-callback>
>
> For this instance:
> $content = ereg_replace( "([0-9]{5})[0-9]{9}" , "\\1", $content);
>
> --
> CC