Skip to content

Instantly share code, notes, and snippets.

@LarryBarker
Created October 1, 2020 14:42
Show Gist options
  • Save LarryBarker/48e184417b72eedcd5f55cca432de574 to your computer and use it in GitHub Desktop.
Save LarryBarker/48e184417b72eedcd5f55cca432de574 to your computer and use it in GitHub Desktop.
Determine the next item in an associative array
<?php
$stages = $this->getStages(); // ['foo'=>'bar','bar'=>'foo']
while (key($stages) !== $this->status) {
next($stages); // advance til there's a match
}
return next($stages);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment