Statement on glibc/iconv Vulnerability

ReflectionEnumBackedCase::getBackingValue

(PHP 8 >= 8.1.0)

ReflectionEnumBackedCase::getBackingValueGets the scalar value backing this Enum case

Descrição

public ReflectionEnumBackedCase::getBackingValue(): int|string

Gets the scalar value backing this Enum case.

Parâmetros

Esta função não possui parâmetros.

Valor Retornado

The scalar equivalent of this enum case.

Exemplos

Exemplo #1 ReflectionEnum::getBackingValue() example

<?php
enum 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());
?>

O exemplo acima produzirá:

string(1) "S"

Veja Também

add a note

User Contributed Notes

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