note 128326 added to function.array-product

From: Date: Mon, 20 Mar 2023 15:38:32 +0000
Subject: note 128326 added to function.array-product
Groups: php.notes 
Request: Send a blank email to php-notes+get-220284@lists.php.net to get a copy of this message
Just a little correction for Andre D's answer: "(bool) array_product($array);" is equivalent with the conjunction of each array elements of $array, UNLESS the provided array is empty in which case array_product() will return 1, which will translate to boolean TRUE. To mitigate this, you should expand the function with an additional check: <?php $result = !empty($check) && !!array_product($check); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 45.95.45.232) ---- Manual Page -- https://php.net/manual/en/function.array-product.php Edit -- https://main.php.net/note/edit/128326 Del: integrated -- https://main.php.net/note/delete/128326/integrated Del: useless -- https://main.php.net/note/delete/128326/useless Del: bad code -- https://main.php.net/note/delete/128326/bad+code Del: spam -- https://main.php.net/note/delete/128326/spam Del: non-english -- https://main.php.net/note/delete/128326/non-english Del: in docs -- https://main.php.net/note/delete/128326/in+docs Del: other reasons-- https://main.php.net/note/delete/128326 Reject -- https://main.php.net/note/reject/128326 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220284) next »