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 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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.
Output for 8.0.13
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 7.1.0 - 7.1.16, 7.2.0 - 7.2.4, 7.3.32 - 7.3.33, 7.4.33
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 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
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.
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.

preferences:
159.47 ms | 402 KiB | 161 Q