3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php print get_domain("somedomain.co.uk"); // outputs 'somedomain.co.uk' function get_domain($domain) { if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) { return $regs['domain']; } return false; }
Output for 4.3.3 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
somedomain.co.uk
Output for 4.3.0 - 4.3.2
Notice: Undefined index: domain in /in/hTciL on line 7