3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Super { public function __construct($something) { $this->something = $something; } public static function make($array) { return array_map(function ($el) { return new static($el); }, $array); } } class Child extends Super { } echo phpversion(), "\n"; print_r(Child::make([1,2,3]));
Output for 5.4.30 - 5.4.45, 5.5.14 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
7.4.0 Array ( [0] => Child Object ( [something] => 1 ) [1] => Child Object ( [something] => 2 ) [2] => Child Object ( [something] => 3 ) )
Output for 5.4.0 - 5.4.29, 5.5.0 - 5.5.13
5.5.13 Fatal error: Cannot instantiate abstract class Super in /in/lk4i0 on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/lk4i0 on line 22
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/lk4i0 on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/lk4i0 on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/lk4i0 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/lk4i0 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/lk4i0 on line 3
Process exited with code 255.

preferences:
56.36 ms | 1814 KiB | 4 Q