3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr1 = array(5, 3, 9, 11, 6, 15); $arr2 = array(11, 20, 1, 3, 8); foreach($arr1 as $a) { $y = 5; $max = max(array_filter($arr2, function ($x, $y) { return $x < $y; })); echo $max; }
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /in/qSCVe:8 Stack trace: #0 [internal function]: {closure}(11) #1 /in/qSCVe(8): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/qSCVe on line 8
Process exited with code 255.
Output for 5.3.0 - 7.0.14
Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: max(): Array must contain at least one element in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: max(): Array must contain at least one element in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: max(): Array must contain at least one element in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: max(): Array must contain at least one element in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: max(): Array must contain at least one element in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: Missing argument 2 for {closure}() in /in/qSCVe on line 8 Notice: Undefined variable: y in /in/qSCVe on line 8 Warning: max(): Array must contain at least one element in /in/qSCVe on line 8
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/qSCVe on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/qSCVe on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/qSCVe on line 8
Process exited with code 255.