3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); ?>
based on QYeKP
Output for 7.1.0 - 7.2.0
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.20
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.3.22 - 5.6.28
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.