function searchNextKey($keyName, $sourceArray) {
if (array_key_exists($keyName, $sourceArray)) {
while (key($sourceArray) !== $keyName) {
next($sourceArray);
}
next($sourceArray);
$nextScenario = key($sourceArray);
return $nextScenario;
}
return null;
}
function searchKey($keyName, $sourceArray) {
if (!(is_string($keyName) || is_numeric($keyName)) || !isset($sourceArray[$keyName])) {
return null;
}
$keys = array_keys($sourceArray);
$nextScenario = @$keys[array_search($keyName, $keys) + 1];
return $nextScenario;
}