note 91360 modified in function.shuffle by danbrown

From: Date: Mon, 08 Jun 2009 12:32:32 +0000
Subject: note 91360 modified in function.shuffle by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156444@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: <?php function array_shuffle($array) { if (shuffle($array)) { return $array; } else { return FALSE; } } ?> --was-- 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; } } http://php.net/manual/en/function.shuffle.php

« previous php.notes (#156444) next »