List Info

Thread: note 71461 added to function.array-product




note 71461 added to function.array-product
user name
2006-11-30 03:04:23
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  -- h
ttps://master.php.net/note/delete/71461/integrated
Del: useless     -- http
s://master.php.net/note/delete/71461/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/71461/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/71461
Reject      -- https://mast
er.php.net/note/reject/71461
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )