1

I am talking about Closures with some friends of a Group (from PHP 5.3).

When I do a var_dump(function(){}); the result is object(Closure). One of peoples said: but Closures are not Object.

I understand what when Anonymous Function implements Closure class, the result need to be a Object, nothing more or different.

Is a anonymous function a object?

UPDATE I have read "Anonymous functions are implemented using the Closure class." (http://php.net/manual/en/functions.anonymous.php), so, I think this is a Object.

2 Answers 2

2

Strongly worded in the manual:

Anonymous functions, implemented in PHP 5.3, yield objects of this type [Closure]. This fact used to be considered an implementation detail, but it can now be relied upon.

http://www.php.net/manual/en/class.closure.php

To be clear, the answer is: yes, they are objects.

Sign up to request clarification or add additional context in comments.

Comments

0

Can you elaborate on what you're trying to do? In PHP Closure is a final class, so technically yes, it's an object.

2 Comments

Have you read my question? I am talking only. Not implementing.
Yes, but you didn't say if you're talking about trying to actually achieve something as part of a group project. If there was no goal you could've checked the documentation here.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.