ID: 19343 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: WinXP PHP Version: 4.2.3 New Comment:
Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. I've tried this a few dosen times and the results were quite random. Please keep in mind that with a small array, such as the one in your example, there are only 24 possible combinations. Which means, that on average every 24th run you'll get an 'unsorted' array. Previous Comments: ------------------------------------------------------------------------ [2002-09-10 14:09:42] [EMAIL PROTECTED] I called array_rand($my_array, count($my_array)). I expected array_rand to return the keys of $my_array in random order. I actually received the keys in almost the same order each time. $my_array was a 4 element array and the third element's key never changed position. I tried using srand also, but it produced same results. On an older version of php(4.1.2) the function worked as expected. script on WinXP php4.2.3: $numbers = range (1,4); $rand_keys = array_rand ($numbers, count($numbers)); foreach ($rand_keys as $val) { print $numbers[$val]."\n"; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19343&edit=1