Page 1 of 1

please help! about preg_replace_callback

Posted: Thu Jul 02, 2009 3:45 am
by zorro
can i transmit other parameters to the function which is called for preg_replace_callback???

please help me, thank u!! :? :? :?

Re: please help! about preg_replace_callback

Posted: Thu Jul 02, 2009 5:13 am
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.

Re: please help! about preg_replace_callback

Posted: Thu Jul 02, 2009 5:23 am
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??

Re: please help! about preg_replace_callback

Posted: Thu Jul 02, 2009 5:49 am
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.