Want to find entry by object property from an array of objects? You either iterate the array, searching for the particular record (ok in a one time only search) or build a hashmap using another associative array.
For the former, something like this:
1 2 3 4 5 6 7 | $item = null; foreach($array as $struct) { if ($v == $struct->ID) { $item = $struct; break; } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.