I like to do an array search and return all values when a match is found. The [name] key in the array is what I do in the search.
Array ( [0] => Array ( [id] => 20120100 [link] => www.janedoe.com [name] => Jane Doe ) [1] => Array ( [id] => 20120101 [link] => www.johndoe.com [name] => John Doe ) )
If I did a John Doe search, he would be back.
Array ( [id] => 20120101 [link] => www.johndoe.com [name] => John Doe )
It would be easier to rename arrays based on what I'm looking for. Instead of the specified array, I can also create the following.
Array ( [Jane Doe] => Array ( [id] => 20120100 [link] => www.janedoe.com [name] => Jane Doe ) [John Doe] => Array ( [id] => 20120101 [link] => www.johndoe.com [name] => John Doe ) )
arrays php
Tim
source share