ID: 26290
Comment by: scottm at spamcop dot net
Reported By: alisovoi at hotmail dot com
Status: Open
Bug Type: Reproducible crash
Operating System: Linux Redhat 9
PHP Version: 4.3.4
New Comment:
Can't confirm under same OS. I used a easier test case.
-----
<?php
$random_sayings = array('Hey, this is not','randomly chosen','elements
from an array');
$i = 0;
echo '<pre>';
while ($i < 1000)
{
print $random_sayings[array_rand($random_sayings)] . "\n";
++$i;
}
echo '</pre>';
?>
Previous Comments:
------------------------------------------------------------------------
[2003-11-17 12:00:36] alisovoi at hotmail dot com
Description:
------------
$array[array_rand($array)] is always the same element of the array.
The server uses php.ini-recommended for the configuration.
(In PHP 4.3.2, this problem is non-existant. PHP 4.3.4 has this bug)
Reproduce code:
---------------
<?php
$random_sayings = array('Hey, this is not','randomly chosen','elements
from an array');
echo($random_sayings[array_rand($random_sayings)]);
?>
Expected result:
----------------
Either one of the 3 elements of the array.
Actual result:
--------------
The same element no matter how many times the user refreshes.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26290&edit=1