$secondReservation = new Reservation("20-10-2014", "25-10-2014", $secondGuest); $thirdReservation = new Reservation("18-10-2014", "26-10-2014", $thirdGuest); $fourReservation = new Reservation("01-10-2014", "17-10-2014", $thirdGuest); $rooms[201] = new SingleRoom(201, 40); BookManager::bookRoom($rooms[201], $firstReservation); BookManager::bookRoom($rooms[201], $fourReservation); $rooms[305] = new SingleRoom(305, 60); BookManager::bookRoom($rooms[305], $firstReservation); BookManager::bookRoom($rooms[305], $secondReservation); $rooms[401] = new SingleRoom(401, 40); $rooms[412] = new Bedroom(412, 70); $rooms[302] = new Bedroom(302, 80); $rooms[202] = new Bedroom(202, 70); $rooms[410] = new Bedroom(410, 80); $rooms[501] = new Apartment(501, 200); BookManager::bookRoom($rooms[501], $secondReservation); $rooms[502] = new Apartment(502, 300); $rooms[601] = new Apartment(601, 350); echo PHP_EOL; echo "Bedrooms and apartments with a price less or equal to 250.00"; echo PHP_EOL; $filteredRooms = array_filter($rooms, "getBedroomsAndApartmentsByPrice"); function getBedroomsAndApartmentsByPrice(Room $room) { if ($room instanceof Bedroom || $room instanceof Apartment) { if ($room->getPrice() <= 250) { return true; } } return false; }