PHP multidimensional array search by value and get array value
Hell here exmple of array search in multidinsional
see the array you can get array key of multidensional and get value using array
check this out put
Array ( [0] => Array ( [typeid] => 1 [typename] => Enveloppe [max_kg] => 0.30 [isactive] => 1 [isdelete] => 0 ) [1] => Array ( [typeid] => 2 [typename] => Documents [max_kg] => 2.00 [isactive] => 1 [isdelete] => 0 ) [2] => Array ( [typeid] => 3 [typename] => Colis [max_kg] => 300.00 [isactive] => 1 [isdelete] => 0 ) )
$new_type_id = array_combine(array_keys($get_row_msttype), array_column($get_row_msttype, 'typename')); $search_typeid = array_search('Enveloppe', $new_type_id); if(is_int($search_typeid)){ $typeid = $get_row_msttype[$search_typeid]['typeid']; // you can get value using array value here }else{ $typeid = ''; } echo $typeid;
No comments:
Post a Comment
Thank You For Comment