3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $a = 1; protected $b = 2; public $c = 3; static public function get_public_vars($object) { $get_public_vars = Closure::bind(function($object) { return get_object_vars($object); }, null, 'stdClass'); return $get_public_vars($object); } } var_dump(A::get_public_vars(new A));
Output for 7.0.0 - 7.2.0
Warning: Cannot bind closure to scope of internal class stdClass in /in/TgMqN on line 13 Fatal error: Uncaught Error: Function name must be a string in /in/TgMqN:15 Stack trace: #0 /in/TgMqN(19): A::get_public_vars(Object(A)) #1 {main} thrown in /in/TgMqN on line 15
Process exited with code 255.
Output for 5.4.2 - 5.6.28
array(1) { ["c"]=> int(3) }
Output for 5.3.17 - 5.3.29
Fatal error: Call to undefined method Closure::bind() in /in/TgMqN on line 11
Process exited with code 255.