PHP 8.1.0 RC 2 available for testing

ReflectionReference::fromArrayElement

(PHP 7 >= 7.4.0, PHP 8)

ReflectionReference::fromArrayElementCreate a ReflectionReference from an array element

Description

public static ReflectionReference::fromArrayElement(array $array, int|string $key): ?ReflectionReference

Creates a ReflectionReference from an array element.

Liste de paramètres

array

The tableau which contains the potential reference.

key

The key; either an entier or a chaîne de caractères.

Valeurs de retour

Returns a ReflectionReference instance if $array[$key] is a reference, or null otherwise.

Erreurs / Exceptions

If array is not an tableau, or key is not an entier or chaîne de caractères, a TypeError is thrown. If $array[$key] does not exist, a ReflectionException is thrown.

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top