- var_dump: documentation ( source)
- is_numeric: documentation ( source)
- array_filter: documentation ( source)
<?php
$array = [ 0 => 'apple', 'b' => 'banana', 3 => 'cow', 'wrench' => 'duck', ];
$filtered = array_filter(
$array,
function ($k) { return is_numeric($k); }, // test to include only numeric keyed
ARRAY_FILTER_USE_KEY // new in PHP 5.6
);
var_dump($filtered);