3v4l.org

run code in 300+ PHP versions simultaneously
<?php $an_array = array(); $reflection = new ReflectionClass($an_object); $properties = $reflection->getProperties(); foreach ($properties as $property) { $property->setAccessible(true); $an_array[$property->getName()] = $property->getValue($an_object); if (!$property->isPublic()) $property->setAccessible(false); } var_dump($an_array);

preferences:
37.94 ms | 402 KiB | 5 Q