3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar; private $baz; public function __construct($bar, $baz) { $this->bar = $bar; $this->baz = $baz; } public function __debugInfo() { return ['bar' => $this->bar]; } } $foo = new Foo('abc', 'def'); print_r(debug_backtrace()); print_r($foo); var_dump(debug_zval_dump($foo)); echo var_export($foo);
based on ONOBj
Output for 7.0.0 - 7.1.0, 7.1.7 - 7.2.0
Array ( ) Foo Object ( [bar] => abc ) object(Foo)#1 (1) refcount(2){ ["bar"]=> string(3) "abc" refcount(1) } NULL Foo::__set_state(array( 'bar' => 'abc', 'baz' => 'def', ))
Output for 7.1.5 - 7.1.6
Array ( ) Foo Object ( [bar] => abc ) object(Foo)#1 (1) refcount(2){ ["bar"]=> string(3) "abc" refcount(3) } NULL Foo::__set_state(array( 'bar' => 'abc', 'baz' => 'def', ))
Output for 5.6.7 - 5.6.28
Array ( ) Foo Object ( [bar] => abc ) object(Foo)#1 (1) refcount(2){ ["bar"]=> string(3) "abc" refcount(2) } NULL Foo::__set_state(array( 'bar' => 'abc', 'baz' => 'def', ))
Output for 5.4.2 - 5.5.35
Array ( ) Foo Object ( [bar:Foo:private] => abc [baz:Foo:private] => def ) object(Foo)#1 (2) refcount(2){ ["bar":"Foo":private]=> string(3) "abc" refcount(1) ["baz":"Foo":private]=> string(3) "def" refcount(1) } NULL Foo::__set_state(array( 'bar' => 'abc', 'baz' => 'def', ))
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/M6qHe on line 14
Process exited with code 255.