[nycphp-talk] QuickForm / PHP (Zend Engine) Bug - callback function never called
Jayesh Sheth
jayeshsh at ceruleansky.com
Thu Mar 17 14:12:37 EST 2005
Hi Dan,
Thanks for your reply.
>Yes. A function has to be declared before you can use it. Functions
>declared normally (outside conditional statements) are declared when the
>file is parsed. Functions declared in conditional statements are
declared
>during run time _when_ _execution_ _gets_ _to_ _them_. So, you can solve
>your issue by reordering your script to put the function declaration
above
>the is_callable() call.
I was not actively aware of this difference before. I tried a similar
example in JavaScript, and it behaved the way you described it.
I guess this is pretty standard practice (in programming languages, that
is), and I was not aware of the differences between the parse order of
functions declared inside of and outside of conditional blocks.
Normally this situation is less common, since I usually declare
functions before I use them (include files that contain related
functions at the top of the page), unless it's QuickForm, in which case
I tend to do it this way.
Best Regards,
- Jay
More information about the talk
mailing list