note 74536 deleted from function.create-function by colder
| From: | colder@php.net | Date: | Mon, 16 Apr 2007 16:41:45 +0000 |
| Subject: | note 74536 deleted from function.create-function by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125445@lists.php.net to get a copy of this message | ||
Note Submitter: kkaiser at revolution-records dot net
Reason: bad code
----
A quick addendum to my previous note:
While my method worked to introduce the desired object into the lambda function as $this, you
can't actually access object methods via the $this keyword; what appears to be happening is PHP
5.x allows $this as a function parameter, passes the object into the function scope as a *variable
called $this*, but when you attempt to access the variable via $this, the interpreter defaults to
thinking you're using the reserved keyword $this and not a variable named $this. The workaround
I had to implement was that when the anonymous function is created, I str_replace $this in the
lambda function's code definition with some awkwardly-named variable like
$abcdefghijklmnopqrstuvwxyz. Everything works fine after that.
-Kevin