3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $source = [ array_combine(range(1,10), range(1,10)), array_combine(range(11,20), range(11,20)), array_combine(range(21,30), range(21,30)) ]; $return = []; foreach($source as $data) { $return = array_merge($return, $data); } $filter = function ($value, $key) { return ($value > 25); }; $return = array_filter($return, $filter, ARRAY_FILTER_USE_BOTH); var_dump($return);
based on 5lCrC
Output for 5.6.8 - 7.2.0
array(5) { [25]=> int(26) [26]=> int(27) [27]=> int(28) [28]=> int(29) [29]=> int(30) }
Output for 5.4.0 - 5.5.35
Notice: Use of undefined constant ARRAY_FILTER_USE_BOTH - assumed 'ARRAY_FILTER_USE_BOTH' in /in/NKOGY on line 19 Warning: array_filter() expects at most 2 parameters, 3 given in /in/NKOGY on line 19 NULL
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/NKOGY 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/NKOGY on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/NKOGY on line 3
Process exited with code 255.