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.
Answer
Solution:
This should work for you:
(Here I just go through each element of the array with
an call
on it)
Output: