$array = [5, 6, null, "javascript", "", null, 9, null, null, 0, null, 8, 3.14, 85];
// Use array_filter to filter out non-numeric or "falsy" values
$array = array_filter($array, function($value) {
return is_numeric($value) && $value != 0;
});
print_r(array_values($array)); // Re-index the array to reset keys
/*
run:
Array
(
[0] => 5
[1] => 6
[2] => 9
[3] => 8
[4] => 3.14
[5] => 85
)
*/