3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $seats = 7; $booked_seat = array('1','4','5','6','7'); $booked_a = array_flip($booked_seat); for ($i=1; $i <= $seats; $i++) { printf("seat: %d%s\n", $i, isset($booked_a[$i]) ? " booked" : ""); }
Output for 4.3.0 - 7.1.0
seat: 1 booked seat: 2 seat: 3 seat: 4 booked seat: 5 booked seat: 6 booked seat: 7 booked