如果$point是333(例如),我希望current($ids)是444:
$ids = array(111, 222, 333, 444);
$point = 333;
如果$point是444,current($ids)是111等等。
我有这段代码,但我正在寻找更简单的东西:
$ids = array(111, 222, 333, 444, 555);
$point = array_search(555, $ids);
while(key($ids) != $point) {
next($ids);
}
$point = next($ids);
if($point == NULL) {
$point = reset($ids);
}
echo $point;