please help! about preg_replace_callback

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zorro
Forum Newbie
Posts: 2
Joined: Thu Jul 02, 2009 3:32 am

please help! about preg_replace_callback

Post by zorro »

can i transmit other parameters to the function which is called for preg_replace_callback???

please help me, thank u!! :? :? :?
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: please help! about preg_replace_callback

Post by prometheuzz »

zorro wrote:can i transmit other parameters to the function which is called for preg_replace_callback???

please help me, thank u!! :? :? :?
Try it.
zorro
Forum Newbie
Posts: 2
Joined: Thu Jul 02, 2009 3:32 am

Re: please help! about preg_replace_callback

Post by zorro »

prometheuzz wrote:
zorro wrote:can i transmit other parameters to the function which is called for preg_replace_callback???

please help me, thank u!! :? :? :?
Try it.

i have tried many times

i think it can not

but i want to define it is really true??
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: please help! about preg_replace_callback

Post by prometheuzz »

zorro wrote:...

i have tried many times

i think it can not

but i want to define it is really true??
You can access global variables [which are outside your call back function]. And there's this thing called "currying" (a.k.a. delayed argument binding) which you might use.

See: http://php.net/manual/en/function.preg- ... llback.php

What you could also do is explain here on the forum what problem you are trying to solve. It is my experience that quite often some one asking for help is determined to solve his/her problem in a certain way, while there is some easier (or better) way to solve it.

Good luck.
Post Reply