I want to use in_array to check multiple integers, e.g checking integer "427971780" key: amenityId if exist anywhere in the array of a array.
The structure of the array is:
array(43) {
[0]=>
array(2) {
["amenityId"]=>
int(427971780)
["amenity"]=>
string(28) "24-timers fitnessfaciliteter"
}
[1]=>
array(2) {
["amenityId"]=>
int(359778141)
["amenity"]=>
string(27) "Antal bygninger/højhuse -3"
}
I'm using this php trying to look into the arrays an finding the integer but it doesen't seem to work.
If I do a
var_dump($hotelAmenities[0]['amenityId']);
it works fine. But I need it to be dynamic, looking up multiple integers. That's the reason for the IF sentence.
for($x=0;$x<50;$x++){
if(in_array("427971780", $hotelAmenities[$x]['amenityId'])){
echo "<li><i class='im im-bar'></i><span class='booking-item-feature-title'>Bar/Lounge</span></li>";
}
}
Can anyone spot for is wrong with the for/if code above?