shuffle() doesn't provide the shuffled array as a return value. Its simply gives bool value instead of shuffled array. If you want to make shuffle(), which gives shuffling elements from an array then use below code.
<?php function array_shuffle($array) { if (shuffle($array)) { return $array; } else { return FALSE; } } $my_array = array("red","green","blue","yellow","purple"); echo "<pre>"; print_r(array_shuffle($my_array)); echo "</pre>"; ?>
0 Comments