Function ze\ray::issetArrayKey()

In PHP:
ze\ray::issetArrayKey(
$array, $key, $key2 = false, $key3 = false, $key4 = false, $key5 = false, $key6 = false, $key7 = false, $key8 = false, $key9 = false
)

Description

A drop in replacement for accessing a variable from an array in a boolean statement, which will not issue an error if the variable is not set.

Shortcut for is_array($array) && isset($array[$key]) && $array[$key]

Example

The following code could be used to check if a value was set in an array and was not empty:

if (issetArrayKey($myArray, 'key'))

If you were certain that $myArray was an array, the example above could be be rewritten using pure PHP:

if (!empty($myArray['key']))

This second example is more efficient as it doesn't involve a function call, but would not work as expected if $myArray was a string.