Help with arrays...
Date: 01/13/06
(PHP Community) Keywords: no keywords
Hi guys,
I'm working with a rather large array (9,266 records). The key is always a 3-character string, but the value is a variable length string. While I'm able to search the array on the keys, I need to be able to search the values to return the keys at times as well.
But array_search() won't work, since it requires an exact match, and I'll need to pull possible matches from a section of the string.
Example: I'm searching the values for the string "augusta". I know this matches 4 records in the array, but I need to pull the keys for this.
The records:
'AGS' => 'Augusta (Bush Field), GA, USA',
'AUG' => 'Augusta State Airport, ME, USA',
'DNL' => 'Augusta (Daniel Field), GA, USA',
'PUG' => 'Port Augusta, South Australia, Australia',
Anyone know of any way I can do this with an array?
EDIT: Yes, I know this is a better job for a db. For the time being, I'm stuck using an array.
Source: http://community.livejournal.com/php/394193.html