这是一个重现我的问题的功能。我有一个数组。数组内部是array( 0 => 'l', 1 => 'j', 2 => 'b')
. b
无论我做什么,请注意总是在最后。
private function fixed_shuffle($data_a, $data_b, $data_c) {
$return_value[] = $data_a;
$return_value[] = $data_b;
$return_value[] = $data_c;
for ($i=0; $i <= 10; $i++) {
srand((double)microtime * 1000000);
shuffle($return_value);
var_dump($return_value);
echo "<br />";
echo implode(",",$return_value);
echo "<br />";
}
}
问题演示,请注意 [2] 始终为 'b':
Current set separated by commas is 'j,l,b'.
Current answer is 'b'.
array(3) { [0]=> string(1) "l" [1]=> string(1) "j" [2]=> string(1) "b" }
l,j,b
array(3) { [0]=> string(1) "j" [1]=> string(1) "l" [2]=> string(1) "b" }
j,l,b
array(3) { [0]=> string(1) "l" [1]=> string(1) "j" [2]=> string(1) "b" }
l,j,b
array(3) { [0]=> string(1) "j" [1]=> string(1) "l" [2]=> string(1) "b" }
j,l,b
array(3) { [0]=> string(1) "l" [1]=> string(1) "j" [2]=> string(1) "b" }
l,j,b
array(3) { [0]=> string(1) "j" [1]=> string(1) "l" [2]=> string(1) "b" }
j,l,b
array(3) { [0]=> string(1) "l" [1]=> string(1) "j" [2]=> string(1) "b" }
l,j,b
array(3) { [0]=> string(1) "j" [1]=> string(1) "l" [2]=> string(1) "b" }
j,l,b
array(3) { [0]=> string(1) "l" [1]=> string(1) "j" [2]=> string(1) "b" }
l,j,b
array(3) { [0]=> string(1) "j" [1]=> string(1) "l" [2]=> string(1) "b" }
j,l,b
array(3) { [0]=> string(1) "l" [1]=> string(1) "j" [2]=> string(1) "b" }