3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_GET = ['pool' => 1, 'beach' => 1, 'concierge' => 1]; // Created a static array for you guys for debugging // page.php?pool=1&beach=1&concierge=1 put this url path at the end of the url so you can get the data im seeing $htls=array(array("HotelName"=>"M Beach Hotel","minprice"=>264,"CountryCode"=>"US",'feature'=>array("type"=>"hotel","pool"=>1,"beach"=>1,'concierge'=>0)), array("HotelName"=>"Hilton","minprice"=>73,"CountryCode"=>"US",'feature'=>array("type"=>"hotel","pool"=>1,"beach"=>0,'concierge'=>1)), array("HotelName"=>"Fontainebleau","minprice"=>375,"CountryCode"=>"US",'feature'=>array("type"=>"resort","pool"=>1,"beach"=>1,'concierge'=>1)), array("HotelName"=>"Woodlow Inn","minprice"=>40,"CountryCode"=>"US",'feature'=>array("type"=>"inn","pool"=>0,"beach"=>0,'concierge'=>0)), array("HotelName"=>"El cabanna","minprice"=>73,"CountryCode"=>"US",'feature'=>array("type"=>"resort","pool"=>1,"beach"=>1,'concierge'=>1)), array("HotelName"=>"James south beach","minprice"=>73,"CountryCode"=>"US",'feature'=>array("type"=>"hotel","pool"=>0,"beach"=>1,'concierge'=>0)), ); $filtered = array_filter($htls, function($hotel) { return !array_diff_assoc($_GET, $hotel['feature']); }); var_dump($filtered);
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
array(2) { [2]=> array(4) { ["HotelName"]=> string(13) "Fontainebleau" ["minprice"]=> int(375) ["CountryCode"]=> string(2) "US" ["feature"]=> array(4) { ["type"]=> string(6) "resort" ["pool"]=> int(1) ["beach"]=> int(1) ["concierge"]=> int(1) } } [4]=> array(4) { ["HotelName"]=> string(10) "El cabanna" ["minprice"]=> int(73) ["CountryCode"]=> string(2) "US" ["feature"]=> array(4) { ["type"]=> string(6) "resort" ["pool"]=> int(1) ["beach"]=> int(1) ["concierge"]=> int(1) } } }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
182.2 ms | 408 KiB | 5 Q