3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function IsExternal($link) { $base_url = sprintf("%s://%s%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'] ); return (substr($link,0,strlen($base_url)-1)==$base_url); } echo IsExternal("http://www.google.com");
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined index: HTTP_HOST in /in/rTnf1 on line 8 Notice: Undefined index: REQUEST_URI in /in/rTnf1 on line 9
Output for 4.3.0 - 5.2.17
Notice: Undefined index: HTTP_HOST in /in/rTnf1 on line 8 Notice: Undefined index: REQUEST_URI in /in/rTnf1 on line 9