This is a discussion on preg_replace with e modifier, how to use class function within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'd like to use something like preg_replace("...","$this->somefunction('\\1','\\2');", $content); It ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I'd like to use something like preg_replace("...","$this->somefunction('\\1','\\2');", $content); It says "Cannot find function somefunction()" I tried some escaping, but didn't work. Any ideas? Jochen -- Jochen Daum - Cabletalk Group Ltd. PHP DB Edit Toolkit -- PHP scripts for building database editing interfaces. http://sourceforge.net/projects/phpdbedittk/ |
|
|||
|
In article <o59n40t486rjkbncbn5lvrug7vq94uc4tq@4ax.com>,
Jochen Daum <jochen.daum@cans.co.nz> wrote: > preg_replace("...","$this->somefunction('\\1','\\2');", $content); > > It says "Cannot find function somefunction()" > > > I tried some escaping, but didn't work. > > Any ideas? Have you tried preg_replace_callback <http://php.net/preg-replace-callback> yet? The user notes contain several examples of calling class methods. -- CC |
|
|||
|
Hi
On Sun, 07 Mar 2004 23:19:53 GMT, CC Zona <cczona@nospam.invalid> wrote: >In article <o59n40t486rjkbncbn5lvrug7vq94uc4tq@4ax.com>, > Jochen Daum <jochen.daum@cans.co.nz> wrote: > >> preg_replace("...","$this->somefunction('\\1','\\2');", $content); >> >> It says "Cannot find function somefunction()" >> >> >> I tried some escaping, but didn't work. >> >> Any ideas? > >Have you tried preg_replace_callback <http://php.net/preg-replace-callback> yet? The user notes contain several examples of calling class methods. Actually not. I expected that the callback gets the 'match' delivered, which I expected to be a string, not an array. Thanks anyway, Jochen -- Jochen Daum - Cabletalk Group Ltd. PHP DB Edit Toolkit -- PHP scripts for building database editing interfaces. http://sourceforge.net/projects/phpdbedittk/ |