note 125385 added to function.in-array

From: Date: Tue, 22 Sep 2020 03:21:33 +0000
Subject: note 125385 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-215454@lists.php.net to get a copy of this message
The top voted notes talked about creating strict comparison function, because in_array is insufficient, because it has very lenient type checking (which is PHP default behaviour). The thing is, in_array is already sufficient. Because as a good programmer, you should never have an array which contains {true, false, 0, 1, '0', '1', null, '', 'hello world'}; all in one array anyway. It's better to fix how you store data and retrieve data from user, rather than fixing in_array() which is not broken. ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.172 (proxied: 84.17.38.155) ---- Manual Page -- http://php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/125385 Del: integrated -- https://master.php.net/note/delete/125385/integrated Del: useless -- https://master.php.net/note/delete/125385/useless Del: bad code -- https://master.php.net/note/delete/125385/bad+code Del: spam -- https://master.php.net/note/delete/125385/spam Del: non-english -- https://master.php.net/note/delete/125385/non-english Del: in docs -- https://master.php.net/note/delete/125385/in+docs Del: other reasons-- https://master.php.net/note/delete/125385 Reject -- https://master.php.net/note/reject/125385 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#215454) next »