array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'reflectionreference.fromarrayelement.php', 1 => 'ReflectionReference::fromArrayElement', ), 'up' => array ( 0 => 'class.reflectionreference.php', 1 => 'ReflectionReference', ), 'prev' => array ( 0 => 'reflectionreference.construct.php', 1 => 'ReflectionReference::__construct', ), 'next' => array ( 0 => 'reflectionreference.getid.php', 1 => 'ReflectionReference::getId', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionreference/fromarrayelement.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7 >= 7.4.0, PHP 8)
ReflectionReference::fromArrayElement — Create a ReflectionReference from an array element
$array
, int|string $key
): ?ReflectionReferenceCreates a ReflectionReference from an array element.
Returns a ReflectionReference instance if
$array[$key]
is a reference, or null
otherwise.
If array
is not an array, or key
is not an int or string, a TypeError is thrown.
If $array[$key]
does not exist,
a ReflectionException is thrown.