note 129714 added to language.enumerations.listing

From: Date: Thu, 22 Aug 2024 07:55:28 +0000
Subject: note 129714 added to language.enumerations.listing
Groups: php.notes 
Request: Send a blank email to php-notes+get-221488@lists.php.net to get a copy of this message
If you want to get all the values of the Enum in a list of string, you might do something like this: <?php enum MyEnum: string { case OPTION_A = 'option_a'; case OPTION_B = 'option_b'; case OPTION_C = 'option_c'; public static function values(): array { return array_map(fn ($case) => $case->value, self::cases()); } } ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 2003:c0:df10:8759:5caf:abdc:6399:5365) ---- Manual Page -- https://php.net/manual/en/language.enumerations.listing.php Edit -- https://main.php.net/note/edit/129714 Del: integrated -- https://main.php.net/note/delete/129714/integrated Del: useless -- https://main.php.net/note/delete/129714/useless Del: bad code -- https://main.php.net/note/delete/129714/bad+code Del: spam -- https://main.php.net/note/delete/129714/spam Del: non-english -- https://main.php.net/note/delete/129714/non-english Del: in docs -- https://main.php.net/note/delete/129714/in+docs Del: other reasons-- https://main.php.net/note/delete/129714 Reject -- https://main.php.net/note/reject/129714 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221488) next »