3v4l.org

run code in 300+ PHP versions simultaneously
<?php class toto { private $maman; private $papa; } $entity = new toto; function getVars($entity){ $vars= \Closure::bind(function($entity) { return get_object_vars($entity); }, null, $entity); return $vars; } var_dump(getVars($entity));

preferences:
74.44 ms | 402 KiB | 5 Q