note 124105 added to function.array-search

From: Date: Sat, 10 Aug 2019 11:15:48 +0000
Subject: note 124105 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-211834@lists.php.net to get a copy of this message
The fastest way to search for a cached value, to find if there is a cycle in your data, to see if a given program state has occurred before, to see whether a value is in a set and then adding it, and for so many similar tasks, is just to do an array dereference: $Key=$SomeStateString1.'|'.$SomeStateString2; // State can have multiple substates if (@$StateSet[$Key]) // or use isset() ; // The key already exists: do optional processing here else ; // The key does not yet exist: do optional processing here $StateSet[$Key]=1; // Store state existence (or store associated data values) ---- Server IP: 208.43.231.9 Probable Submitter: 82.199.157.54 (proxied: 98.2.238.89) ---- Manual Page -- http://php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/124105 Del: integrated -- https://master.php.net/note/delete/124105/integrated Del: useless -- https://master.php.net/note/delete/124105/useless Del: bad code -- https://master.php.net/note/delete/124105/bad+code Del: spam -- https://master.php.net/note/delete/124105/spam Del: non-english -- https://master.php.net/note/delete/124105/non-english Del: in docs -- https://master.php.net/note/delete/124105/in+docs Del: other reasons-- https://master.php.net/note/delete/124105 Reject -- https://master.php.net/note/reject/124105 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211834) next »