3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { public $name; public function __construct($name) { $this->name = $name; } public function name($name) { return $this->name($name); } } $user = new Person('chris'); var_dump($user->name());
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Person::name(), 0 passed in /in/8n67u on line 21 and exactly 1 expected in /in/8n67u:11 Stack trace: #0 /in/8n67u(21): Person->name() #1 {main} thrown in /in/8n67u on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Missing argument 1 for Person::name(), called in /in/8n67u on line 21 and defined in /in/8n67u on line 11 Notice: Undefined variable: name in /in/8n67u on line 13 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 262144 bytes) in /in/8n67u on line 13
Process exited with code 255.
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Warning: Missing argument 1 for Person::name(), called in /in/8n67u on line 21 and defined in /in/8n67u on line 11 Notice: Undefined variable: name in /in/8n67u on line 13 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 130968 bytes) in /in/8n67u on line 13
Process exited with code 255.

preferences:
204.96 ms | 402 KiB | 223 Q