Gets the scalar value backing this Enum case

- « ReflectionEnumBackedCase::__construct

- ReflectionZendExtension »

- PHP Manual
- ReflectionEnumBackedCase
- Gets the scalar value backing this Enum case

# ReflectionEnumBackedCase::getBackingValue

(PHP 8 >= 8.1.0)

ReflectionEnumBackedCase::getBackingValue — Gets the scalar value backing this Enum case

### Description

public ReflectionEnumBackedCase::getBackingValue(): int|string

Gets the scalar value backing this Enum case.

### Parameters

This function has no parameters.

### Return Values

The scalar equivalent of this enum case.

### Examples

Example #1 ReflectionEnum::getBackingValue() example

    <?phpenum Suit: string{    case Hearts = 'H';    case Diamonds = 'D';    case Clubs = 'C';    case Spades = 'S';}$rEnum = new ReflectionEnum(Suit::class);$rCase = $rEnum->getCase('Spades');var_dump($rCase->getBackingValue());?>

The above example will output:

    string(1) "S"

### See Also

- Enumerations