Php, array of objects, get all classname of objects

456

I have an array:

$array = array();
$array[] = new Class1();
$array[] = new Class2();
$array[] = new Class3();

var_dump ($array); // returns the objects
var_dump (array_values($array)); // same as above
var_dump (array_keys($array)); // returns empty array

I want something which returns with ['Class1', 'Class2', 'Class3'], so aget_class() on each object.

People are also looking for solutions to the problem: php - Symfony2 WebProfiler (500): Variable "app" does not exist in @Doctrine/Collector/db.html.twig at line 1

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.