我的代码有问题。我想做的是在数组被调用时从数组中删除一个项目,这意味着我希望每个输出都不同。我想用它来旋转代理,阵列中有超过 150 个代理。这是我的代码示例。
for ( $i = 1; $i < 2; $i++ )
{
// If the array_history is empty, re-populate it.
if (empty($array_history))
$array_history = $array;
// Select a random key.
$key = array_rand($array_history, 1);
// Save the record in $selected.
$selected = $array_history[$key];
// Remove the key/pair from the array.
unset($array_history[$key]);
// Echo the selected value.
echo $selected;
}
我该怎么做,或者 for 循环不适合这个?提前致谢。
PIPIONE
鸿蒙传说
函数式编程