3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = [ (object)["guestEmail" => "you@booking.com"], (object)["guestEmail" => "you@okay.com"], (object)["guestEmail" => "me@booking.com"], (object)["guestEmail" => "n/a"], (object)["guestEmail" => "somebodyelse@booking.com"], (object)["guestEmail" => "youAgain@BOOKING.COM"] ]; $blacklist = ['@guest.booking.com', '@booking.com', 'N/A', 'n.c@hotel.com', 'n.c@hotels.com']; foreach ($rows as $row) { foreach ($blacklist as $b) { if (stripos($row->guestEmail, $b) !== false) { if (isset($blacklistedcounts[$b])) { // this important to avoid Notices ++$blacklistedcounts[$b]; // increment after the element key exists } else { $blacklistedcounts[$b] = 1; // set 1 on first occurrence } break; // no need to check for other matches for this guestEmail } } } var_export($blacklistedcounts);
Output for git.master, git.master_jit, rfc.property-hooks
array ( '@booking.com' => 4, 'N/A' => 1, )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.8 ms | 405 KiB | 5 Q