3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class A { public function toArray() { return get_object_vars($this); } } class C extends A { private $private = 'A'; protected $protected = 'B'; public $public = 'C'; } print_r(new C()->toArray());
Output for 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [protected] => B [public] => C )
Output for 8.3.0 - 8.3.30
Parse error: syntax error, unexpected token "->", expecting ")" in /in/bfjgJ on line 17
Process exited with code 255.

preferences:
165.57 ms | 1014 KiB | 7 Q