3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function domainGetFromURL($url, $strip_www = true) { echo parse_url($url); 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 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Array to string conversion in /in/sTI1p on line 6 Array281654
Output for 4.3.0 - 5.3.29
Array281654