Re: [PHP] preg_replace_callback

2012-04-20 Thread TR Shaw
Bug #61792: preg_replace_callback memory leak

On Apr 20, 2012, at 4:43 PM, Igor Konforti wrote:

> Please reply here with bug #number
> 
> :)
> 
> On Fri, Apr 20, 2012 at 23:21, TR Shaw  wrote:
> 
>> 
>> On Apr 20, 2012, at 4:18 PM, Stuart Dallas wrote:
>> 
>>> On 20 Apr 2012, at 21:00, TR Shaw wrote:
>>> 
 It appears that preg_replace_callback has a memory leak  at least in
>> version 5.3.8.
>>> 
>>> Based on what? If you have a repeatable test that demonstrates this
>> behaviour please create a bug report at https://bugs.php.net/ with all
>> the details.
>> 
>> Thanks. Will do.
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback

2012-04-20 Thread Igor Konforti
Please reply here with bug #number

:)

On Fri, Apr 20, 2012 at 23:21, TR Shaw  wrote:

>
> On Apr 20, 2012, at 4:18 PM, Stuart Dallas wrote:
>
> > On 20 Apr 2012, at 21:00, TR Shaw wrote:
> >
> >> It appears that preg_replace_callback has a memory leak  at least in
> version 5.3.8.
> >
> > Based on what? If you have a repeatable test that demonstrates this
> behaviour please create a bug report at https://bugs.php.net/ with all
> the details.
>
> Thanks. Will do.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] preg_replace_callback

2012-04-20 Thread TR Shaw

On Apr 20, 2012, at 4:18 PM, Stuart Dallas wrote:

> On 20 Apr 2012, at 21:00, TR Shaw wrote:
> 
>> It appears that preg_replace_callback has a memory leak  at least in version 
>> 5.3.8.
> 
> Based on what? If you have a repeatable test that demonstrates this behaviour 
> please create a bug report at https://bugs.php.net/ with all the details.

Thanks. Will do.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback

2012-04-20 Thread Stuart Dallas
On 20 Apr 2012, at 21:00, TR Shaw wrote:

> It appears that preg_replace_callback has a memory leak  at least in version 
> 5.3.8.

Based on what? If you have a repeatable test that demonstrates this behaviour 
please create a bug report at https://bugs.php.net/ with all the details.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

What does mah_process_tags do anyway? XD


Ah, hehe... Oh, basically I am trying to write a plugin for the 
Textpattern CMS:




processTags() is a core TXP function... Basically, it parses any TXP 
template tags ().


Long story short, I am am modifying the processTags() function so that 
it looks for class methods when parsing template tags, vs. looking for 
regular functions.


Thanks again Casey! I really appreciate your help. :)
Cheers,
Micky

--
Wishlist: 
Switch: 
BCC?: 
My: 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Casey
On Sun, Mar 30, 2008 at 10:06 PM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Casey wrote:
>  > Hmmm. I've searched around, and it seems that only a global would work :/
>
>  Thanks for the help Casey! I really appreciate it. :)
>
>  Yah, I think I will use a global for now... Until I can think of an
>  alternative coding approach.
>
>  Have a good one!
>
>
>
>  Cheers,
>  Micky
>
>
What does mah_process_tags do anyway? XD

-- 
-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

Hmmm. I've searched around, and it seems that only a global would work :/


Thanks for the help Casey! I really appreciate it. :)

Yah, I think I will use a global for now... Until I can think of an 
alternative coding approach.


Have a good one!

Cheers,
Micky


--
Wishlist: 
Switch: 
BCC?: 
My: 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Casey
On Sun, Mar 30, 2008 at 9:37 PM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Casey wrote:
>  > preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
>  > Does this work?
>
>  Awww, does not seem to work. :(
>
>  But maybe I need to dink with the code a bit more...
>
>  I would like to avoid setting a global here. :D
>
>  Thanks for the help Casey! I will let you know if I get it working. I
>  may just have to think of a different approach here.
>
>
>
>  Cheers,
>  Micky
>
>

Hmmm. I've searched around, and it seems that only a global would work :/

-- 
-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?


Awww, does not seem to work. :(

But maybe I need to dink with the code a bit more...

I would like to avoid setting a global here. :D

Thanks for the help Casey! I will let you know if I get it working. I 
may just have to think of a different approach here.


Cheers,
Micky


--
Wishlist: 
Switch: 
BCC?: 
My: 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread micky
Hi Casey! Many thanks for your help! I greatly appreciate it. :)

>>  preg_replace_callback($f, 'mah_processTags($arg1)', $text);
> preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
> Does this work?

Ah, interesting... Thanks for the example code... I am at work now, but
will try that as soon as I get home later tonight. Your code examp looks
very promising -- I will let you know how it goes.

A billion thanks!

Cheers,
Micky




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Casey
On Sun, Mar 30, 2008 at 1:17 AM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  This is probably simple to answer for most of ya'll, but...
>
>  preg_replace_callback($f, 'mah_processTags', $text);
>
>  Besides the matches, how would I pass function args/param to
>  mah_processTags()?
>
>  For example, I would like to do something like this:
>
>  preg_replace_callback($f, 'mah_processTags($arg1)', $text);
preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?

>  function mah_processTags($matches, $arg1) { ... }
>
>  Is this even possible? I just want to pass-in $arg1 along with the
>  matches. :)
>
>  Possible?
>
>  Many thanks in advance!!!
>  Cheers,
>  Micky
>
>  --
>  Wishlist: 
>  Switch: 
>  BCC?: 
>  My: 
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 8:03 am, tJey wrote:
> Hi. I have problem with preg_replace_callback. It seems that my
> pattern
> is bad, but I can't find any error.
>
> Pattern : \[\s*((\d|\w|_)+)\s*\]
> this pattern is intended to find strings like "[field]",
> "[ fi12_eld]"...
>
> but every time I get warning message
> "Warning: preg_replace_callback(): Delimiter must not be alphanumeric
> or
> backslash in test.php on line 100"

The first and last character in preg_*('...') have to be delimiters
for the pattern, to distinguish it from flags at the end.

EG:
$pattern = '/\[\s*((\d|\w|_)+)\s*\]/';

You might, for example, want to tack on mUs or even i (though that
would be silly here for something like:
$pattern = '/\[\s*((\d|\w|_)+)\s*\]/sU';

Also note that \ is a 'special' character inside of ' for PHP, so SOME
PHP developers thinks this is "better style":

$pattern = '/\\[\\s*((\\d|\\w|_)+\\s*\\]/';

PHP "eats" the \\ to feed \ to PCRE which "eats" those up to get the
special characters it wants.

Also, I *think* maybe the \ in front of ] is not needed, as there is
no opening [ to "confuse" PCRE in the first place, since you escaped
that.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] preg_replace_callback

2006-05-04 Thread Ford, Mike
On 04 May 2006 14:04, tJey wrote:

> Hi. I have problem with preg_replace_callback. It seems that my
> pattern is bad, but I can't find any error.
> 
> Pattern : 
> this pattern is intended to find strings like "[field]", "[
> fi12_eld]"... 
> 
> but every time I get warning message
> "Warning: preg_replace_callback(): Delimiter must not be alphanumeric
> or backslash in test.php on line 100"

The error message suggests you haven't included the necessary pattern 
delimiters, like for example:

   preg_replace_callback("|\[\s*((\d|\w|_)+)\s*\]|", ...
or
   preg_replace_callback("@\[\s*((\d|\w|_)+)\s*\]@", ...
or
   preg_replace_callback("{\[\s*((\d|\w|_)+)\s*\]}", ...

etc, etc!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] preg_replace_callback

2006-05-04 Thread Jay Blanchard
[snip]
Hi. I have problem with preg_replace_callback. It seems that my pattern 
is bad, but I can't find any error.

Pattern : \[\s*((\d|\w|_)+)\s*\]
this pattern is intended to find strings like "[field]",
"[ fi12_eld]"...

but every time I get warning message
"Warning: preg_replace_callback(): Delimiter must not be alphanumeric or

backslash in test.php on line 100"
[/snip]

I think you need pipes or forward slashes around your pattern. Have a
look at TFM to see how they do it there;
http://www.php.net/preg_replace_callback

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_replace_callback clarification

2004-09-09 Thread François Moreau
Thank you very much for your quick answer!
Le 04-09-09, à 10:10, John Holmes a écrit :
From: "François Moreau" <[EMAIL PROTECTED]>
The piece of code you have submitted (see under) is interesting, 
although there is one thing I don't find meaning to, even after RTFM, 
and STFG(Searching The Funky Google). In your regular expression 
pattern '#.*#Uis', what does this do : #...#Uis
[snip]
$new_str = preg_replace_callback('#.*#Uis','myreplace',$str);
The # characters simply start and end the pattern. You can use any 
character for that, really. I normally use /, but since it's present 
in the pattern "" and I didn't want to escape it, I used the # 
character.

The characters after the pattern delimiters are called pattern 
modifiers. They are explained here 
(http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php), 
but for the afraid-to-clicky-people:

U - ungreedy (makes sure the .* in the pattern doesn't match too much)
i - case-insensitive matching (in case you use  and )
s - makes the dot character match newlines as well, otherwise text 
between bold tags that included newlines wouldn't be matches.

---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] preg_replace_callback clarification

2004-09-09 Thread John Holmes
From: "François Moreau" <[EMAIL PROTECTED]>
The piece of code you have submitted (see under) is interesting, although 
there is one thing I don't find meaning to, even after RTFM, and 
STFG(Searching The Funky Google). In your regular expression pattern 
'#.*#Uis', what does this do : #...#Uis
[snip]
$new_str = preg_replace_callback('#.*#Uis','myreplace',$str);
The # characters simply start and end the pattern. You can use any character 
for that, really. I normally use /, but since it's present in the pattern 
"" and I didn't want to escape it, I used the # character.

The characters after the pattern delimiters are called pattern modifiers. 
They are explained here 
(http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php), but for 
the afraid-to-clicky-people:

U - ungreedy (makes sure the .* in the pattern doesn't match too much)
i - case-insensitive matching (in case you use  and )
s - makes the dot character match newlines as well, otherwise text between 
bold tags that included newlines wouldn't be matches.

---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] preg_replace_callback and brackets

2003-03-30 Thread Marek Kilimajer
Maybe you should use

/\b/

   word boundary

instead of all the or's

Joshua Moore-Oliva wrote:

I'm kind of confused right now...  when I call preg_replace_callback with a 
regular expression with brackets, sometimes I get an array back with multiple 
elements like

array(3) {
 [0]=>
 string(19) "http://www.aol.com
"
 [1]=>
 string(0) ""
 [2]=>
 string(19) "http://www.aol.com
"
}
and I have no idea why...  Why does the middle one have nothing in it?  the 
regular expression was

$dumb_body = preg_replace_callback ( '/'
  //Case spaceURLspace
  . '([\s]http:\/\/[^\s]+[\s])'
  . '|'
  //Case URLspace
  . '(^http:\/\/[^\s]+[\s])'
  . '|'
  //Case spaceURL
  . '([\s]http:\/\/[^\s]+$)'
  . '|'
  //Case URL
  . '(^http:\/\/[^\s]+$)'
  . '/i'
  , array( &$this, "storeUrlCallback" ), 
$dumb_body );

I am very confused at the point of the array in this function period...  can 
anyone help?

Josh.

 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [PHP-DOC] Re: [PHP] preg_replace_callback

2002-11-18 Thread Derick Rethans
On Mon, 18 Nov 2002, Bikeman wrote:

> Me again.
> 
> I think this really badly documented in the documentation.  I hope this is
> solved soon.  To be more detailed:  The preg_replace_callback()-function
> documentation says it is the same as the preg_replacec()-function, except
> for the second argument.  Apparently, it is not, since it doesn't support
> multiple patterns to be recognized and replaced.  I think this should be
> made clear.  I suppose I'll be using the preg_replace(), then.  Maybe I'll
> try to find the way-in-between, with the /e-modifier ...  I thought the
> callback-variant was more elegant, but I have to get it to work, so ...

Please file a bugreport in the "Documentation problem" so that we won't 
forget this.

Derick

> "John W. Holmes" <[EMAIL PROTECTED]> wrote in message
> 006101c28e91$4609e190$7c02a8c0@coconut">news:006101c28e91$4609e190$7c02a8c0@coconut...
> > "callback" should be the name of a function that determines what the
> > matched pattern will be replaced with.
> >
> > Maybe you just need the regular preg_replace(), instead of the one with
> > callback?
> >
> > ---John Holmes...
> >
> > > -Original Message-
> > > From: Bikeman [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, November 17, 2002 2:23 PM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-
> > > [EMAIL PROTECTED]
> > > Subject: [PHP] preg_replace_callback
> > >
> > > Hello.
> > >
> > > I have totally no clue at all wether I am posting in the right
> > newsgroup
> > > here, and I was not planning on caching all messages in my (first time
> > > used,
> > > I prefer Outlook) Outlook Express before searching.  So if I am
> > disobeying
> > > all rules here ...  I'm sorry ...  I just am not an experienced news-
> > > service
> > > user ...
> > >
> > > Now, my question/remark/bug report.  It concerns, ad you could guess,
> > the
> > > preg_replace_callback function.  The manual is very short on this
> > > function,
> > > and the comments posted on the online-version of the manual, are not
> > > helping
> > > me, either ...  I am trying to use this function as the regular
> > > preg_replace
> > > can be used, namely woth a patterns-array, a replacement-array (which
> > gets
> > > the callback-array) and a subject.  This doesn't work, though ...  It
> > > appears as if the callback-variant of the preg_replace version isn't
> > > capable
> > > of handling multiple patterns at a time.  This is the error-message I
> > get:
> > > "Warning: preg_replace_callback() requires argument 2, 'Array', to be
> > a
> > > valid callback in ...".  I pass it, as a second argument, an Array
> > that
> > > consists of strings containing the names of functions I defined later
> > in
> > > my
> > > php-file.  (Hmmm ...  Could that be the problem?  Tha fact that I
> > define
> > > the
> > > functions AFTER I give the Array tot the functions?  Don't think so,
> > > though
> > > ...)
> > >
> > > Did anybody have the same experience, or am I really doing something
> > > wrong?
> > >
> > > Tnx in advance for any reply!!
> > >
> > > Bikeman
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> 
> 
> 
> -- 
> PHP Documentation Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 

---
 Derick Rethans   http://derickrethans.nl/ 
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] preg_replace_callback

2002-11-18 Thread Bikeman
Me again.

I think this really badly documented in the documentation.  I hope this is
solved soon.  To be more detailed:  The preg_replace_callback()-function
documentation says it is the same as the preg_replacec()-function, except
for the second argument.  Apparently, it is not, since it doesn't support
multiple patterns to be recognized and replaced.  I think this should be
made clear.  I suppose I'll be using the preg_replace(), then.  Maybe I'll
try to find the way-in-between, with the /e-modifier ...  I thought the
callback-variant was more elegant, but I have to get it to work, so ...

Greetz,
Bikeman


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
006101c28e91$4609e190$7c02a8c0@coconut">news:006101c28e91$4609e190$7c02a8c0@coconut...
> "callback" should be the name of a function that determines what the
> matched pattern will be replaced with.
>
> Maybe you just need the regular preg_replace(), instead of the one with
> callback?
>
> ---John Holmes...
>
> > -Original Message-
> > From: Bikeman [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, November 17, 2002 2:23 PM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-
> > [EMAIL PROTECTED]
> > Subject: [PHP] preg_replace_callback
> >
> > Hello.
> >
> > I have totally no clue at all wether I am posting in the right
> newsgroup
> > here, and I was not planning on caching all messages in my (first time
> > used,
> > I prefer Outlook) Outlook Express before searching.  So if I am
> disobeying
> > all rules here ...  I'm sorry ...  I just am not an experienced news-
> > service
> > user ...
> >
> > Now, my question/remark/bug report.  It concerns, ad you could guess,
> the
> > preg_replace_callback function.  The manual is very short on this
> > function,
> > and the comments posted on the online-version of the manual, are not
> > helping
> > me, either ...  I am trying to use this function as the regular
> > preg_replace
> > can be used, namely woth a patterns-array, a replacement-array (which
> gets
> > the callback-array) and a subject.  This doesn't work, though ...  It
> > appears as if the callback-variant of the preg_replace version isn't
> > capable
> > of handling multiple patterns at a time.  This is the error-message I
> get:
> > "Warning: preg_replace_callback() requires argument 2, 'Array', to be
> a
> > valid callback in ...".  I pass it, as a second argument, an Array
> that
> > consists of strings containing the names of functions I defined later
> in
> > my
> > php-file.  (Hmmm ...  Could that be the problem?  Tha fact that I
> define
> > the
> > functions AFTER I give the Array tot the functions?  Don't think so,
> > though
> > ...)
> >
> > Did anybody have the same experience, or am I really doing something
> > wrong?
> >
> > Tnx in advance for any reply!!
> >
> > Bikeman
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] preg_replace_callback

2002-11-17 Thread Philip Olson


Please make all replies to this ONLY go to php-general, thank you.



On Sun, 17 Nov 2002, John W. Holmes wrote:

> "callback" should be the name of a function that determines what the
> matched pattern will be replaced with. 
> 
> Maybe you just need the regular preg_replace(), instead of the one with
> callback?
> 
> ---John Holmes...
> 
> > -Original Message-
> > From: Bikeman [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, November 17, 2002 2:23 PM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-
> > [EMAIL PROTECTED]
> > Subject: [PHP] preg_replace_callback
> > 
> > Hello.
> > 
> > I have totally no clue at all wether I am posting in the right
> newsgroup
> > here, and I was not planning on caching all messages in my (first time
> > used,
> > I prefer Outlook) Outlook Express before searching.  So if I am
> disobeying
> > all rules here ...  I'm sorry ...  I just am not an experienced news-
> > service
> > user ...
> > 
> > Now, my question/remark/bug report.  It concerns, ad you could guess,
> the
> > preg_replace_callback function.  The manual is very short on this
> > function,
> > and the comments posted on the online-version of the manual, are not
> > helping
> > me, either ...  I am trying to use this function as the regular
> > preg_replace
> > can be used, namely woth a patterns-array, a replacement-array (which
> gets
> > the callback-array) and a subject.  This doesn't work, though ...  It
> > appears as if the callback-variant of the preg_replace version isn't
> > capable
> > of handling multiple patterns at a time.  This is the error-message I
> get:
> > "Warning: preg_replace_callback() requires argument 2, 'Array', to be
> a
> > valid callback in ...".  I pass it, as a second argument, an Array
> that
> > consists of strings containing the names of functions I defined later
> in
> > my
> > php-file.  (Hmmm ...  Could that be the problem?  Tha fact that I
> define
> > the
> > functions AFTER I give the Array tot the functions?  Don't think so,
> > though
> > ...)
> > 
> > Did anybody have the same experience, or am I really doing something
> > wrong?
> > 
> > Tnx in advance for any reply!!
> > 
> > Bikeman
> > 
> > 
> > 
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] preg_replace_callback

2002-11-17 Thread John W. Holmes
"callback" should be the name of a function that determines what the
matched pattern will be replaced with. 

Maybe you just need the regular preg_replace(), instead of the one with
callback?

---John Holmes...

> -Original Message-
> From: Bikeman [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, November 17, 2002 2:23 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-
> [EMAIL PROTECTED]
> Subject: [PHP] preg_replace_callback
> 
> Hello.
> 
> I have totally no clue at all wether I am posting in the right
newsgroup
> here, and I was not planning on caching all messages in my (first time
> used,
> I prefer Outlook) Outlook Express before searching.  So if I am
disobeying
> all rules here ...  I'm sorry ...  I just am not an experienced news-
> service
> user ...
> 
> Now, my question/remark/bug report.  It concerns, ad you could guess,
the
> preg_replace_callback function.  The manual is very short on this
> function,
> and the comments posted on the online-version of the manual, are not
> helping
> me, either ...  I am trying to use this function as the regular
> preg_replace
> can be used, namely woth a patterns-array, a replacement-array (which
gets
> the callback-array) and a subject.  This doesn't work, though ...  It
> appears as if the callback-variant of the preg_replace version isn't
> capable
> of handling multiple patterns at a time.  This is the error-message I
get:
> "Warning: preg_replace_callback() requires argument 2, 'Array', to be
a
> valid callback in ...".  I pass it, as a second argument, an Array
that
> consists of strings containing the names of functions I defined later
in
> my
> php-file.  (Hmmm ...  Could that be the problem?  Tha fact that I
define
> the
> functions AFTER I give the Array tot the functions?  Don't think so,
> though
> ...)
> 
> Did anybody have the same experience, or am I really doing something
> wrong?
> 
> Tnx in advance for any reply!!
> 
> Bikeman
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php