3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Value { protected $value; public function __construct($value) { $this->value = $value; } public function getValue() { return $this->value; } } $three = new Value(3); $four = new Value(4); $closure = function ($delta, $de) { var_dump($delta+$de); }; //$a = new closure(); $closure(4); $closure->call($three, 4, 3, 5); $closure->call($four, 4, 2 , 1); ?>
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in /in/A9T5M on line 19 and exactly 2 expected in /in/A9T5M:17 Stack trace: #0 /in/A9T5M(19): {closure}(4) #1 {main} thrown in /in/A9T5M on line 17
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Warning: Missing argument 2 for {closure}(), called in /in/A9T5M on line 19 and defined in /in/A9T5M on line 17 Notice: Undefined variable: de in /in/A9T5M on line 17 int(4) int(7) int(6)
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: Missing argument 2 for {closure}(), called in /in/A9T5M on line 19 and defined in /in/A9T5M on line 17 Notice: Undefined variable: de in /in/A9T5M on line 17 int(4) Fatal error: Call to undefined method Closure::call() in /in/A9T5M on line 21
Process exited with code 255.

preferences:
238.68 ms | 402 KiB | 332 Q