Re: Executing functions within ereg_replace() output
| From: | CC Zona | Date: | Sun, 07 Apr 2002 00:30:36 +0000 |
| Subject: | Re: Executing functions within ereg_replace() output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91895@lists.php.net to get a copy of this message | ||
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