<?php $commands = array("mark", "ignore", "pick", "random"); $attempts = array("mark", "ignore", "pick", "random", "bonk"); foreach($attempts as $attempt){ echo "$attempt => "; $index=array_search($attempt,$commands); if($index===false || !isset($commands[++$index])){ // not found or found last element $index=0; // use first element } echo $commands[$index],"\n"; }
You have javascript disabled. You will not be able to edit any code.