3v4l.org

run code in 300+ PHP versions simultaneously
<?php // I just killed one unicorn. [*] $_POST = array(); foreach ( range(1, 99) as $index ) { $_POST[ 'a'. $index ] = $index; } $find = "18"; $finded = array_filter($_POST, function($index) use ($find) { return (strpos($index,$find) !== false ) ? 1 : 0 ; },ARRAY_FILTER_USE_KEY); print_r($finded);
Output for 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 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.18, 8.3.0 - 8.3.6
Array ( [a18] => 18 )
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35
Notice: Use of undefined constant ARRAY_FILTER_USE_KEY - assumed 'ARRAY_FILTER_USE_KEY' in /in/lF7pF on line 15 Warning: array_filter() expects at most 2 parameters, 3 given in /in/lF7pF on line 15

preferences:
164.16 ms | 402 KiB | 274 Q