日期:2014-05-17 浏览次数:20422 次
<?php function kshuffle(&$array) { if(!is_array($array) || empty($array)) { return false; } $tmp = array(); foreach($array as $key => $value) { $tmp[] = array('k' => $key, 'v' => $value); } shuffle($tmp); $array = array(); foreach($tmp as $entry) { $array[$entry['k']] = $entry['v']; } return true; }