How can I search value from Multidimensional array using PHP -


array (         [0] => array (                         [id] => 13137                         [meta_value] => chris                         [field_id] => 104                         [item_id] => 4413                         [created_at] => 2015-06-17 17:00:21                     )         [1] => array (                         [id] => 13136                         [meta_value] => 0.10                         [field_id] => 123                         [item_id] => 4413                         [created_at] => 2015-06-17 17:00:21                      )       ); 

how access meta_value (chris) field_id = 104?

make use of array_search function

 $key = array_search(104, array_column($array, 'field_id'));  if($key !== false)  {        echo $array[$key]['meta_value'];  } 

demo


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -