Re: Code References

From: Date: Mon, 19 May 2003 15:30:00 +0000
Subject: Re: Code References
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-1722@lists.php.net to get a copy of this message
It evals the string at the time it is called to create an "anonymous" function. From then on, its a function, just like any other, and is called just like any other. --Wez. On Mon, 19 May 2003, George Schlossnagle wrote: > > On Monday, May 19, 2003, at 11:13 AM, Zeev Suraski wrote: > > > At 16:41 19/05/2003, Sterling Hughes wrote: > >> Well, its much more than a lookup, its an eval. > > > > No it isn't. It's a lookup. > > I'm on neither side of this, but the create funciton code certainly > looks like it does an eval: > > eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME) > +Z_STRLEN_PP(z_function_args) > +2 /* for the args parentheses */ > +2 /* for the curly braces */ > +Z_STRLEN_PP(z_function_code); > > eval_code = (char *) emalloc(eval_code_length); > sprintf(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", > Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code)); > > eval_name = > zend_make_compiled_string_description("runtime-created function" > TSRMLS_CC); > retval = zend_eval_string(eval_code, NULL, eval_name TSRMLS_CC);

« previous php.internals (#1722) next »