PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $array = [1,2,3,4,5]; function getNext($array, $prev = false) { shuffle($array); if (!$prev) { return current($array); } do { $next = current($array); } while ($next != $prev); return $next; } echo getNext($array);
Show:  
Copy Clear