No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

ReflectionEnum::isBacked

(PHP 8 >= 8.1.0)

ReflectionEnum::isBackedDetermines if an Enum is a Backed Enum

Description

public ReflectionEnum::isBacked(): bool

A Backed Enum is one that has a native backing scalar equivalent, either a string or an int. Not all Enums are backed.

PHP: ReflectionEnum::isBacked - Manual Home of Manuel PHP  Contents Haut

Parameters

This function has no parameters.

PHP: ReflectionEnum::isBacked - Manual Home of Manuel PHP  Contents Haut

Return Values

true if the Enum has a backing scalar, false if not.

PHP: ReflectionEnum::isBacked - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 ReflectionEnum::isBacked() example

<?php
enum Suit
{
case
Hearts;
case
Diamonds;
case
Clubs;
case
Spades;
}

enum BackedSuit: string
{
case
Hearts = 'H';
case
Diamonds = 'D';
case
Clubs = 'C';
case
Spades = 'S';
}

var_dump((new ReflectionEnum(Suit::class))->isBacked());
var_dump((new ReflectionEnum(BackedSuit::class))->isBacked());
?>

The above example will output:

bool(false)
bool(true)

Find a PHP function
Error Infobrol

Can not display this page of the Infobrol website

Type of error (18-01)

Unknown format specifier "&"

Please try again in a few minutes…

Return to the home page




Steph