(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.
This function has no parameters.
The enum case object described by this reflection object.
Example #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());
?>
The above example will output:
enum(Suit::Diamonds)
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant