Diviner

Function idx()

Definedsrc/utils/utils.php:38
GroupCore Utilities

wild idx(array $array, $key, $default = null)

parametersarray$arrayArray to access.
scalar$keyIndex to access in the array.
wild$defaultDefault value to return if the key is not present in the array.
returnwildIf $array[$key] exists, that value is returned. If not, $default is returned without raising a warning.

Access an array index, retrieving the value stored there if it exists or a default if it does not. This function allows you to concisely access an index which may or may not exist without raising a warning.