3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function domainGetFromURL($url, $strip_www = true) { if (!$p = @parse_url($url)) { return ''; } if (strlen($p['host']) == 0) { return ''; } if ($strip_www) { $domain = preg_replace('#^www\.(www\.)*#', '', strtolower($p['host'])); } else { $domain = strtolower($p['host']); } return $domain; } $url = 'http://281654'; echo domainGetFromURL($url, false);
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
281654
Output for hhvm-3.10.0

Process exited with code 153.