下面是一个php脚本,它不干净也不友好或多或少需要指出它为什么会导致我的服务器崩溃的方向,我试图在我的服务器上查看我的错误日志,但它崩溃了,我现在无法访问它......我的php技能不是那么好......任何帮助表示赞赏:
$checker = 0;
function shuffleArray($myArray) {
$value_count = array_count_values($myArray);
$last_value = $myArray[count($myArray) - 1];
unset($myArray[count($myArray) - 1]);
$shuffle = array();
$last = false;
while (count($myArray) > 0) {
$keys = array_keys($myArray);
$i = round(rand(0, count($keys) - 1));
while ($last === $myArray[$keys[$i]] ) {
$i = round(rand(0, count($keys) - 1));
echo "stuck";$checker++;
if($checker>100){
echo " Too many checks so die, and restart process ";
exit;
}
}
$shuffle[] = $myArray[$keys[$i]];
$last = $myArray[$keys[$i]];
unset($myArray[$keys[$i]]);
}
if ($last_value === $last) {
$i = 0;
foreach($shuffle as $key=>$value) {
if ($value !== $last_value) {
$i = $key;
break;
}
}
array_slice($shuffle, $i + 1, 0, $last_value);
} else {
$shuffle[] = $last_value;
}
return $shuffle;
}
$shuffleReel = (shuffleArray($virtualReel));
function bob(){
if($checker>100){
$checker = 0;
shuffleArray();
echo "bob";
reset($myArray);
}
}