枚举常量

虽然 enum 可以包括 public、private、protected 的常量, 但由于它不支持继承,因此在实践中 private 和 protected 效果是相同的。

枚举常量可以引用枚举条目:

<?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