Err, Pseudo-oplines, but since I don't exactly know anything about PHP opcodes, I'm just pulling this stuff out of my ass.

CREATE_FUNCTION test

CREATE_FUNCTION zend_anon_0

RET_VAL 0

END_FUNCTION

END_FUNCTION

CALL 'test'

ASSIGN $0, $valuefunction

It looks like you misunderstand how the engine compiles functions. Each function has its own op array. Also, the code you brought is less interesting. More interesting is code such as:

function prefixer($p)
{
   $f = function ($name) { return "$p. $name"; }
   return $f;
}

$mr = prefixer("Mr");
$mrs = prefixer("Mrs");

echo $mr("Jones");
echo $mrs("Jones");

As you could have guessed, that should result in "Mr. Jones" and "Mrs. Jones" printed. Figuring out where the "Mr." comes from when $mr("Jones") is called would help understand how closure works.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to