3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
Warning: include_once(): open_basedir restriction in effect. File(geoip.inc) is not within the allowed path(s): (/tmp:/in:/etc) 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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.91 ms | 401 KiB | 8 Q