TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   object(Closure)#1 (0) { } (http://www.talkphp.com/general/4742-object-closure-1-0-a.html)

Orc 07-16-2009 04:35 AM

object(Closure)#1 (0) { }
 
In PHP 5.3.0, when I do this:
Code:

var_dump(function(){});
It returns an object named Closure, functions are objects now?

JaoudeStudios 07-16-2009 04:53 AM

No, not as far as I know, but as of PHP 5.3 anonymous (closures) functions are allow similar to javascript.

Salathe 07-16-2009 08:40 AM

That type of anonymous function creates an instance of the Closure class, which has the magic __invoke method used when the function is called. Only that type of anonymous function is an object, regular plain old functions are not.


All times are GMT. The time now is 09:04 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0