note 128193 added to unitenum.cases
| From: | avishkasenanayake at hotmail dot com | Date: | Mon, 06 Feb 2023 12:32:46 +0000 |
| Subject: | note 128193 added to unitenum.cases | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220150@lists.php.net to get a copy of this message | ||
If anyone is here wondering how to get all the names from the enum cases and map them into an array,
it can be done like this:
array_column(CampaignPeriods::cases(), 'name');
Likewise, have the 2nd argument as 'value' to get the enum's values.
Happy coding, web artisan :)
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.158.213 (proxied: 2402:d000:8120:2f66:d2b:46a:9901:3eb1)
----
Manual Page -- https://php.net/manual/en/unitenum.cases.php
Edit -- https://main.php.net/note/edit/128193
Del: integrated -- https://main.php.net/note/delete/128193/integrated
Del: useless -- https://main.php.net/note/delete/128193/useless
Del: bad code -- https://main.php.net/note/delete/128193/bad+code
Del: spam -- https://main.php.net/note/delete/128193/spam
Del: non-english -- https://main.php.net/note/delete/128193/non-english
Del: in docs -- https://main.php.net/note/delete/128193/in+docs
Del: other reasons-- https://main.php.net/note/delete/128193
Reject -- https://main.php.net/note/reject/128193
Search -- https://main.php.net/manage/user-notes.php