3v4l.org

run code in 300+ PHP versions simultaneously
<?php $objs = (object)[ 'data' => [ (object)['guestEmail' => 'bad@example.com'], (object)['guestEmail' => 'okay@goodstuff.com'], (object)['guestEmail' => 'nope@example1.com'] ] ]; $blacklist = ['@example.com', 'example1.com']; $regex = '~\Q' . implode('\E|\Q', $blacklist) . '\E~'; foreach ($objs->data as $row) { if (!preg_match($regex, $row->guestEmail)) { $emails[] = $row->guestEmail; } } var_export($emails);

preferences:
27.88 ms | 402 KiB | 5 Q