note 128220 added to function.in-array
| From: | ArmandsRieksti at main dot php dot net | Date: | Tue, 14 Feb 2023 10:45:29 +0000 |
| Subject: | note 128220 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220176@lists.php.net to get a copy of this message | ||
I'd like to point out that, if you're using Enum data structures and want to compare
whether an array of strings has a certain string Enum in it, you need to cast it to a string.
From what I've tested, the function works correctly:
if the array is filled with strings and you're searching for a string;
if the array is filled with Enums and you're searching for an Enum.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 213.175.78.22)
----
Manual Page -- https://php.net/manual/en/function.in-array.php
Edit -- https://main.php.net/note/edit/128220
Del: integrated -- https://main.php.net/note/delete/128220/integrated
Del: useless -- https://main.php.net/note/delete/128220/useless
Del: bad code -- https://main.php.net/note/delete/128220/bad+code
Del: spam -- https://main.php.net/note/delete/128220/spam
Del: non-english -- https://main.php.net/note/delete/128220/non-english
Del: in docs -- https://main.php.net/note/delete/128220/in+docs
Del: other reasons-- https://main.php.net/note/delete/128220
Reject -- https://main.php.net/note/reject/128220
Search -- https://main.php.net/manage/user-notes.php