3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php include_once('geoip.inc'); //set an IPv6 address for testing $ip='2601:8:be00:cf20:ca60:ff:fe09:35b5'; /* test if $ip is v4 or v6 and assign appropriate .dat file in $gi run appropriate function geoip_country_code_by_addr() vs geoip_country_code_by_addr_v6() */ if((strpos($ip, ":") === false)) { //ipv4 $gi = geoip_open("/usr/share/GeoIP/GeoIP1.dat",GEOIP_STANDARD); $country = geoip_country_code_by_addr($gi, $ip); } else { //ipv6 $gi = geoip_open("/usr/share/GeoIP/GeoIPv6.dat",GEOIP_STANDARD); $country = geoip_country_code_by_addr_v6($gi, $ip); } echo $ip . "<br>" . $country;
Output for 7.1.20, 7.2.5 - 7.2.6
Warning: include_once(): open_basedir restriction in effect. File(geoip.inc) is not within the allowed path(s): (/tmp:/in) in /in/mnjrh on line 2 Warning: include_once(geoip.inc): failed to open stream: Operation not permitted in /in/mnjrh on line 2 Warning: include_once(): Failed opening 'geoip.inc' for inclusion (include_path='.:') in /in/mnjrh on line 2 Fatal error: Uncaught Error: Call to undefined function geoip_open() in /in/mnjrh:18 Stack trace: #0 {main} thrown in /in/mnjrh on line 18
Process exited with code 255.
Output for 7.1.0 - 7.1.16, 7.2.0 - 7.2.4
Warning: include_once(geoip.inc): failed to open stream: No such file or directory in /in/mnjrh on line 2 Warning: include_once(): Failed opening 'geoip.inc' for inclusion (include_path='.:') in /in/mnjrh on line 2 Fatal error: Uncaught Error: Call to undefined function geoip_open() in /in/mnjrh:18 Stack trace: #0 {main} thrown in /in/mnjrh on line 18
Process exited with code 255.
Output for hhvm-3.22.0
Warning: include_once(geoip.inc): File not found in /in/mnjrh on line -1 Fatal error: Uncaught Error: Call to undefined function geoip_open() in /in/mnjrh:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Warning: include_once(geoip.inc): File not found in /in/mnjrh on line 2 Fatal error: Uncaught Error: Call to undefined function geoip_open() in /in/mnjrh:18 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: include_once(geoip.inc): failed to open stream: No such file or directory in /in/mnjrh on line 2 Warning: include_once(): Failed opening 'geoip.inc' for inclusion (include_path='.:') in /in/mnjrh on line 2 Fatal error: Call to undefined function geoip_open() in /in/mnjrh on line 18
Process exited with code 255.