The accepted answer works for the example values, but in general simply using array_filter($a) is probably not a good idea, because it will filter out any actual zero values as well as zero length strings.
Even '0' evaluates to false, so you should use a filter that explicitly excludes zero length strings.
As a late look, item controls should be done with numeric check. Otherwise something like this $array = [1.2, 0.33, [123]] will corrupt the calculation:
// Get numerics only.
$array = array_filter($array, fn($v) => is_numeric($v));
// Get numerics only where value > 0.
$array = array_filter($array, fn($v) => is_numeric($v) && ($v > 0));