Below is the code:
function swap(&$a, &$b)
{
list($a, $b) = array($b, $a);
}
for ($i=0; count($resultset);$i++)
{
for($j=1;$j<5;$j++)
{
$k = rand(1, 4);
swap($resultset[$i]["option".$j],$resultset[$i]["option".$k]);
}
}
It is a two-dimensional array from a MySQL query, I want to shuffle the values whose keys are option1, option2, option3 and option4. But my code doesn't work. I can find the error by myself. Please suggest. Thanks in advance!