note 127278 deleted from language.enumerations.backed by crell
| From: | crell@php.net | Date: | Wed, 13 Jul 2022 23:54:31 +0000 |
| Subject: | note 127278 deleted from language.enumerations.backed by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-219001@lists.php.net to get a copy of this message | ||
Note Submitter: Aym
----
You want to add some constants on Enum case? You can use class constant(only if their value is not a
global constant)!
Here's an example :
<?php
class Something
{
const PARENT = 'parent';
}
enum MyEnum:string
{
case firstChild = Something::PARENT . '_child1';
case secondChild = Something::PARENT . '_child2';
}
echo MyEnum::firstChild->value; // print "parent_child1"