note 91360 added to function.shuffle
| From: | aalaap at gmail dot com | Date: | Mon, 08 Jun 2009 12:12:36 +0000 |
| Subject: | note 91360 added to function.shuffle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156443@lists.php.net to get a copy of this message | ||
I've been wondering why shuffle() doesn't provide the shuffled array as a return value
instead of a bool. I mean, what could possibly go wrong in shuffling elements from an array?
So I use something like this:
function array_shuffle($array) {
if (shuffle($array)) {
return $array;
} else {
return FALSE;
}
}
----
Server IP: 59.162.86.33
Probable Submitter: 64.255.180.21 (proxied: 60.254.53.224)
----
Manual Page -- http://www.php.net/manual/en/function.shuffle.php
Edit -- https://master.php.net/note/edit/91360
Del: integrated -- https://master.php.net/note/delete/91360/integrated
Del: useless -- https://master.php.net/note/delete/91360/useless
Del: bad code -- https://master.php.net/note/delete/91360/bad+code
Del: spam -- https://master.php.net/note/delete/91360/spam
Del: non-english -- https://master.php.net/note/delete/91360/non-english
Del: in docs -- https://master.php.net/note/delete/91360/in+docs
Del: other reasons-- https://master.php.net/note/delete/91360
Reject -- https://master.php.net/note/reject/91360
Search -- https://master.php.net/manage/user-notes.php