Re: Question about strlen I think
| From: | CC Zona | Date: | Mon, 16 Jul 2001 07:07:45 +0000 |
| Subject: | Re: Question about strlen I think | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58019@lists.php.net to get a copy of this message | ||
In article <20010716050155.66968.qmail@pb1.pair.com>,
denniskaan@multiweb.nl (Dennis Kaandorp) wrote:
Ah. I see why you're having trouble: documentation of the 'F' modifier has
apparently be excised from the manual since the preg_replace_callback() has
replaced it in PHP 4.0.5. If you've got 4.0.5, use the new function
instead. If you've got an earlier version, here's the info on 'F':
"If this modifier is set, preg_replace() treats the replacement parameter
as a function name that should be called to provide the replacement string.
The function is passed an array of matched elements in the subject string.
NOTE: this modifier cannot be used along with /e modifier; and only
preg_replace() recognizes this modifier."
For example:
$ftpdata['path'] = preg_replace("/(matchtext)/F",
"replace_func",$ftpdata['path']);
function replace_func($arr)
{
...
}
> argh.. it was to complicated for me :(
> Can you help me with this?
> $ftpdata['path'] = preg_replace($ftpdata['path']);
> Thnx
>
> "Cc Zona" <cczona@nospam.invalid> wrote in message
> news:20010715202016.11557.qmail@pb1.pair.com...
> > In article <20010715162831.10040.qmail@pb1.pair.com>,
> > denniskaan@multiweb.nl (Dennis Kaandorp) wrote:
> >
> > > Is there a way to replace the spaces between the paths?
> > > This is what I mean:
> > > /uploads/ /by/ /dennis/
> > > must become
> > > /uploads/<4sp>/by/<3sp>dennis/
> >
> > See <http://php.net/preg-replace>. You can use the
> > "e" or "f" modifier to
> > count the number of captured spaces and write that number into your
> "<4sp>"
> > replacement pattern.
--
CC