- array_reduce: documentation ( source)
- array_product: documentation ( source)
- array_filter: documentation ( source)
<?php
$array = [1, 4, 3, 0, 5];
$product = array_reduce($array, function ($c, $v) { return $c * ($v == 0 ? 1 : $v); }, 1);
echo $product;
$product = array_product(array_filter($array));
echo $product;