I have this code :
$order_list = array ( array ("tangible", 1, 8, 33, 19000),
array ("tangible", 1, 9, 8, 19000),
array ("tangible", 6, 3, 24, 19000),
array ("tangible", 6, 2, 10, NULL),
array ("tangible", 1, 17, 11, 28000));
$key = array_search(3, array_column($order_list, $order_list[2]));
and I want to get the value of $order_list[$i][3] based on $order_list[$i][2].
for example, if I put :
3 I will get 24 in return
9 I will get 8 in return
and so on...
I tried to use array_search :
$key = array_search(3, array_column($order_list, $order_list[2]));
but I got this error :
Warning: array_column(): The column key should be either a string or an integer in /home/***/public_html/***.php on line 8
Warning: array_search() expects parameter 2 to be array, boolean given in /home/***/public_html/***.php on line 8
how to perform array_serach in this case? thanks before.
vendor_id. and 3 and 2 areproduct_id. we don't do search based onvendor_id, but based onproduct_id. and the result is 24 or 10. which are number of pcs.