Re: Re: preg_replace_callback

From: Date: Mon, 18 Nov 2002 13:52:37 +0000
Subject: Re: Re: preg_replace_callback
References: 1 2 3  Groups: php.doc php.general 
Request: Send a blank email to phpdoc+get-969349772@lists.php.net to get a copy of this message
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" <holmes072000@charter.net> wrote in message > 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:bikeman82@hotmail.com] > > > Sent: Sunday, November 17, 2002 2:23 PM > > > To: phpdoc@lists.php.net; php-general@lists.php.net; php- > > > lang@lists.php.net > > > 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? ]-

« previous php.doc (#969349772) next »