3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array(7,31,32); $str = ""; for($i=0;$i<count($arr);$i++) { if($i==0){ $str = "(IF(`AmenitiesProperty`.`amenity_id` = ".$arr[$i].",1,0)"; } else { $str = "(IF(`AmenitiesProperty`.`amenity_id` = ".$arr[$i].",".$str.",0)"; } } echo $str; //IF(`AmenitiesProperty`.`amenity_id` = 7,(IF(`AmenitiesProperty`.`amenity_id` = 31,(IF(`AmenitiesProperty`.`amenity_id` = 32,1,0)),0)),0)
Output for 4.3.0 - 5.0.5, 5.1.1 - 7.2.0
(IF(`AmenitiesProperty`.`amenity_id` = 32,(IF(`AmenitiesProperty`.`amenity_id` = 31,(IF(`AmenitiesProperty`.`amenity_id` = 7,1,0),0),0)
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/eSDXm on line 14
Process exited with code 255.