note 126723 added to language.enumerations.basics
| From: | sajjad dot golchin at main dot php dot net | Date: | Wed, 29 Dec 2021 07:52:06 +0000 |
| Subject: | note 126723 added to language.enumerations.basics | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217433@lists.php.net to get a copy of this message | ||
<?php
enum Colors
{
case Red;
case Blue;
case Green;
public function getColor(): string
{
return $this->name;
}
}
function paintColor(Colors $colors): void
{
echo "Paint : " . $colors->getColor() . PHP_EOL;
}
paintColor(Colors::Red);
paintColor(Colors::Green);
paintColor(Colors::Blue);
/*
output :
------------------------
Paint : Red
Paint : Green
Paint : Blue
*/
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 185.169.233.111)
----
Manual Page -- https://php.net/manual/en/language.enumerations.basics.php
Edit -- https://main.php.net/note/edit/126723
Del: integrated -- https://main.php.net/note/delete/126723/integrated
Del: useless -- https://main.php.net/note/delete/126723/useless
Del: bad code -- https://main.php.net/note/delete/126723/bad+code
Del: spam -- https://main.php.net/note/delete/126723/spam
Del: non-english -- https://main.php.net/note/delete/126723/non-english
Del: in docs -- https://main.php.net/note/delete/126723/in+docs
Del: other reasons-- https://main.php.net/note/delete/126723
Reject -- https://main.php.net/note/reject/126723
Search -- https://main.php.net/manage/user-notes.php