note 124105 deleted from function.array-search by crell

From: Date: Thu, 31 Mar 2022 20:40:41 +0000
Subject: note 124105 deleted from function.array-search by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217957@lists.php.net to get a copy of this message
Note Submitter: David Spector ---- 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)

« previous php.notes (#217957) next »