$img = array
(
array("1.jpg","Logo","Tigre"),
array("2.jpg","Logo","Cão"),
array("3.jpg","Logo","Montanha"),
array("4.jpg","banner","Design Grafico"),
array("5.jpg","Logo","Dentista"),
array("6.jpg","Logo","Basketball")
);
I wanted the array to look like this
$img = array
(
array("5.jpg","Logo","Dentista"),
array("1.jpg","Logo","Tigre"),
array("4.jpg","banner","Design Grafico"),
array("3.jpg","Logo","Montanha"),
array("2.jpg","Logo","Cão"),
array("6.jpg","Logo","Basketball")
);
I tried this:
function shuffle_assoc($list) {
if (!is_array($list)) return $list;
$keys = array_keys($list);
shuffle($keys);
$random = array();
foreach ($keys as $key) {
$random[$key] = $list[$key];
}
return $random;
}
$img = array
(
array("1.jpg","Logo","Tigre"),
array("2.jpg","Logo","Cão"),
array("3.jpg","Logo","Montanha"),
array("4.jpg","banner","Design Grafico"),
array("5.jpg","Logo","Dentista"),
array("6.jpg","Logo","Basketball")
);
$img = shuffle_assoc($img);
print_r($img);