3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooContainer { private $foo = 'private'; protected $bar = 'protected'; public $baz = 'public'; public function toArray() { return get_object_vars($this); } } class BarContainer extends FooContainer { private $fooChild = 'private'; protected $barChild = 'protected'; public function toArrayInChild() { return get_object_vars($this); } } $instance = new BarContainer(); var_dump( 'toArray', $instance->toArray(), 'toArrayInChild', $instance->toArrayInChild() );

preferences:
46.95 ms | 402 KiB | 5 Q