note 128645 added to language.enumerations.basics
| From: | nemwiper at tiscalinet dot it | Date: | Tue, 27 Jun 2023 13:25:40 +0000 |
| Subject: | note 128645 added to language.enumerations.basics | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220605@lists.php.net to get a copy of this message | ||
It seems that there are some notation missing.
The enum can have name and values, something like:
<?php
enum Colors: string
{
case Red = 'red';
case Black = 'black';
}
$color = Colors::Red;
echo($color->name); //Red
echo($color->value); //red
?>
As described here in this comment:
https://www.php.net/manual/en/language.enumerations.listing.php#127240
That's very useful! ;)
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 79.11.109.196)
----
Manual Page -- https://php.net/manual/en/language.enumerations.basics.php
Edit -- https://main.php.net/note/edit/128645
Del: integrated -- https://main.php.net/note/delete/128645/integrated
Del: useless -- https://main.php.net/note/delete/128645/useless
Del: bad code -- https://main.php.net/note/delete/128645/bad+code
Del: spam -- https://main.php.net/note/delete/128645/spam
Del: non-english -- https://main.php.net/note/delete/128645/non-english
Del: in docs -- https://main.php.net/note/delete/128645/in+docs
Del: other reasons-- https://main.php.net/note/delete/128645
Reject -- https://main.php.net/note/reject/128645
Search -- https://main.php.net/manage/user-notes.php