php - Checking for date string in multidimensional array and returning corresponding keys -


i have multidimensional array in following format:

$array = array (   0 =>      array (       'date' => '2013-03-25',       'name' => 'bob'     ),   1 =>      array (       'date' => '2013-03-25',       'name' => 'brian'     ),   2 =>      array (       'date' => '2013-03-26',       'name' => 'jack'     ),   3 =>      array (       'date' => '2013-03-26',       'name' => 'bob'     ) ); 

i have php loop cycles through each date of year (this works fine). within loop check if there entries in array above date in question, , if so, each entry found return corresponding key 'name'. want run sql query each name returned, presumably create loop these queries.

i have tried few things succeeded in getting muddle. perhaps there relatively straightforward way of achieving this?

$array2 = array(); foreach( $array $item )     $array2[$item['date']][] = $item['name']; 

now check whether there names date, check

if( isset( $array2[$date] ) ) # 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -