array_product() New Checks¶
array_product() used to cast the arguments to integers before executing the multiplications. Nowadays, the strange types raise a warning, as illustrated here with the array.
PHP code¶
<?php
print array_product([1, true, []]);
?>
Before¶
1
After¶
PHP Warning: array_product(): Multiplication is not supported on type array in /codes/arrayProdChecks.php on line 3
Warning: array_product(): Multiplication is not supported on type array in /codes/arrayProdChecks.php on line 3
1
PHP version change¶
This behavior changed in 8.3