I want to check value in array if exits then show “Exits” otherwise show “Not in Array”..
1).
I create a array=>
$browse['pro_id'] = $id;
$browse['pro_name'] = $mobile_details[0]['pro_name'];
$browse['pro_brand'] = $mobile_details[0]['pro_brand'];
$browse['pro_price_own'] = $mobile_details[0]['pro_price_own'];
$mob_arr = $browse;
print_r($browse);
//This print array like this..
Array
(
[pro_id] => mob810013034
[pro_name] => Galaxy Y S5360
[pro_brand] => Samsung
[pro_price_own] => 6291
)
2). After this 2 time . i am pusing array in above given array=>
array_push($mob_arr,$browse);
print_r($mob_arr);
//This print array like this...
Array
(
[pro_id] => mob810013034
[pro_name] => Galaxy Y S5360
[pro_brand] => Samsung
[pro_price_own] => 6291
[0] => Array
(
[pro_id] => mobka10013042
[pro_name] => A 1
[pro_brand] => Karbonn
[pro_price_own] => 6000
)
)
I want to check if [pro_id]=mobka10013042 in whole array then continue; else puch array again in $mob_arr
array_push($mob_arr,$browse);
I use in_array but its not working for this…
Please Give me suggestion …..
Try to create a structure like this:
Then use pop to retrieve whose values: