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 $fooCild = 'private'; public function toArrayInChild() { return get_object_vars($this); } } $instance = new BarContainer(); var_dump( $instance->toArray(), $instance->toArrayInChild() );

preferences:
31.6 ms | 402 KiB | 5 Q