3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['a','b',0,'c',1,2,'ee',3,4,5,'t','x','w']; $numbers = array_filter($array, 'is_numeric'); var_export($numbers); var_export(array_diff_key($array, $numbers));
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
array ( 2 => 0, 4 => 1, 5 => 2, 7 => 3, 8 => 4, 9 => 5, )array ( 0 => 'a', 1 => 'b', 3 => 'c', 6 => 'ee', 10 => 't', 11 => 'x', 12 => 'w', )

preferences:
88.81 ms | 407 KiB | 5 Q