3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [ array_combine(range(1,10), range(1,10)), array_combine(range(11,20), range(11,20)), array_combine(range(21,30), range(21,30)) ]; $data = new stdClass(); $data->data = []; $filter = function ($value) { return ($key < 25); }; var_dump(array_filter($array, $filter));
based on Xen0l
Output for 5.4.0 - 7.2.0
Notice: Undefined variable: key in /in/ZM0Al on line 12 Notice: Undefined variable: key in /in/ZM0Al on line 12 Notice: Undefined variable: key in /in/ZM0Al on line 12 array(3) { [0]=> array(10) { [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) [6]=> int(6) [7]=> int(7) [8]=> int(8) [9]=> int(9) [10]=> int(10) } [1]=> array(10) { [11]=> int(11) [12]=> int(12) [13]=> int(13) [14]=> int(14) [15]=> int(15) [16]=> int(16) [17]=> int(17) [18]=> int(18) [19]=> int(19) [20]=> int(20) } [2]=> array(10) { [21]=> int(21) [22]=> int(22) [23]=> int(23) [24]=> int(24) [25]=> int(25) [26]=> int(26) [27]=> int(27) [28]=> int(28) [29]=> int(29) [30]=> int(30) } }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ZM0Al on line 3
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 '[' in /in/ZM0Al on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZM0Al on line 3
Process exited with code 255.