Page MenuHomePhabricator

function idx($array, $key, $default)
libphutil Technical Documentation (Core Utilities)

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.

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