(PHP 8 >= 8.1.0)
ReflectionEnumUnitCase::getValue — Gets the enum case object described by this reflection object
Returns the enum case object described by this reflection object.
Diese Funktion besitzt keine Parameter.
The enum case object described by this reflection object.
Beispiel #1 ReflectionEnum::getValue() example
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
$rEnum = new ReflectionEnum(Suit::class);
$rCase = $rEnum->getCase('Diamonds');
var_dump($rCase->getValue());
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
enum(Suit::Diamonds)