|
Posted by Andy Hassall on 04/16/07 19:33
On 15 Apr 2007 22:14:12 -0700, "lawrence k" <lkrubner@geocities.com> wrote:
>Just noticed this for the first time:
>
>http://us2.php.net/manual/en/function.create-function.php
>
>Anyone know if PHP supports enclosures, like Javascript or Ruby? I've
>always assumed PHP lacked these. If I create a function with object
>instances, will the instances retain their state if the function
>definition is stored in a variable?
No, PHP doesn't support closures; create_function is basically just a
restricted eval(). The function definition is a string, and isn't connected to
the scope from which create_function is called.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|