note 71461 added to function.array-product

From: Date: Thu, 30 Nov 2006 03:04:23 +0000
Subject: note 71461 added to function.array-product
Groups: php.notes 
Request: Send a blank email to php-notes+get-120175@lists.php.net to get a copy of this message
Regarding Andre D function to test if all values in an array of booleans are true, you can also use: <?php $allTrue = (! in_array(false, $arrayToCheck)); ?> Both this method and Andre D's are O(n), but this method has a lower k in the average case: in_array() stops once it finds the first false, while array_product must always traverse the entire array. ---- Server IP: 216.194.113.175 Probable Submitter: 24.148.147.65 ---- Manual Page -- http://www.php.net/manual/en/function.array-product.php Edit -- https://master.php.net/note/edit/71461 Del: integrated -- https://master.php.net/note/delete/71461/integrated Del: useless -- https://master.php.net/note/delete/71461/useless Del: bad code -- https://master.php.net/note/delete/71461/bad+code Del: spam -- https://master.php.net/note/delete/71461/spam Del: non-english -- https://master.php.net/note/delete/71461/non-english Del: in docs -- https://master.php.net/note/delete/71461/in+docs Del: other reasons-- https://master.php.net/note/delete/71461 Reject -- https://master.php.net/note/reject/71461 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120175) next »