Aufzählungen und Konstanten

Enums können Konstanten enthalten, die public, private oder protected sein können, wobei private und protected praktisch gleichwertig sind, da Vererbung nicht erlaubt ist.

Eine Enum-Konstante kann sich auf einen Enum-Fall beziehen:

<?php

enum Size
{
case
Small;
case
Medium;
case
Large;

public const
Huge = self::Large;
}
?>
add a note add a note

User Contributed Notes

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