Dan_Mason Posted April 6, 2011 Share Posted April 6, 2011 I am having trouble searching for an item in a multi-dimensional array. Is there a way to search only one column in a multi-dimensional array? i.e: MULTI-DIMENSIONAL ARRAY ID Name DataTable 0 John Employee 1 Dan Employee 2 Matt Boss 3 Becky Supervisor Is there a way to only search the column "Name"(Column 2) using array_search() or similar? (i.e array_search("John",$ARRAY[Column2]) The help would be very much appreciated! Cheers, Dan Link to comment https://forums.phpfreaks.com/topic/232847-searching-a-multidimensional-array/ Share on other sites More sharing options...
monkeytooth Posted April 6, 2011 Share Posted April 6, 2011 echo $arrayVariableName[0]['name'] but to search in an array I think similar to above maybe? in_array() possibly. http://www.w3schools.com/php/func_array_in_array.asp Link to comment https://forums.phpfreaks.com/topic/232847-searching-a-multidimensional-array/#findComment-1197650 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.