note 127487 added to language.enumerations.overview
| From: | ironwoods dot es at main dot php dot net | Date: | Fri, 12 Aug 2022 16:07:50 +0000 |
| Subject: | note 127487 added to language.enumerations.overview | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219424@lists.php.net to get a copy of this message | ||
Enums are available from PHP 8.1
Writting next code:
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
with PHP 8.1.0 is OK!
With PHP 7.4.30 and PHP 8.0.22 the results respectively are:
Parse error: syntax error, unexpected 'Suit' (T_STRING) in /home/user/scripts/code.php on
line 3
and
Parse error: syntax error, unexpected identifier "Suit" in /home/user/scripts/code.php on
line 3
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.173 (proxied: 88.22.196.70)
----
Manual Page -- https://php.net/manual/en/language.enumerations.overview.php
Edit -- https://main.php.net/note/edit/127487
Del: integrated -- https://main.php.net/note/delete/127487/integrated
Del: useless -- https://main.php.net/note/delete/127487/useless
Del: bad code -- https://main.php.net/note/delete/127487/bad+code
Del: spam -- https://main.php.net/note/delete/127487/spam
Del: non-english -- https://main.php.net/note/delete/127487/non-english
Del: in docs -- https://main.php.net/note/delete/127487/in+docs
Del: other reasons-- https://main.php.net/note/delete/127487
Reject -- https://main.php.net/note/reject/127487
Search -- https://main.php.net/manage/user-notes.php