3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rx = "^.+(?:@\..+)? $"; $ip = '8.8.8.8'; $mary = 'mary@'.$ip; $g = 'google.com:80/test?abc=123#a1'; $c = 'john:smith@8.8.8.8:80/test?abc=123#a1'; preg_match("/$rx/",$ip,$matches); echo $matches[0],"\n"; preg_match("/$rx/",$mary,$matches); echo $matches[0],"\n"; preg_match("/$rx/",$g,$matches); echo $matches[0],"\n"; preg_match("/$rx/",$c,$matches); echo $matches[0];

preferences:
18.25 ms | 402 KiB | 5 Q