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;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mnjrh
function name:  (null)
number of ops:  35
compiled vars:  !0 = $ip, !1 = $gi, !2 = $country
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INCLUDE_OR_EVAL                                          'geoip.inc', INCLUDE_ONCE
    5     1        ASSIGN                                                   !0, '2601%3A8%3Abe00%3Acf20%3Aca60%3Aff%3Afe09%3A35b5'
   11     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 '%3A'
          5        DO_ICALL                                         $5      
          6        TYPE_CHECK                                    4          $5
          7      > JMPZ                                                     ~6, ->20
   13     8    >   INIT_FCALL_BY_NAME                                       'geoip_open'
          9        SEND_VAL_EX                                              '%2Fusr%2Fshare%2FGeoIP%2FGeoIP1.dat'
         10        FETCH_CONSTANT                                   ~7      'GEOIP_STANDARD'
         11        SEND_VAL_EX                                              ~7
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !1, $8
   14    14        INIT_FCALL_BY_NAME                                       'geoip_country_code_by_addr'
         15        SEND_VAR_EX                                              !1
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0  $10     
         18        ASSIGN                                                   !2, $10
         19      > JMP                                                      ->31
   18    20    >   INIT_FCALL_BY_NAME                                       'geoip_open'
         21        SEND_VAL_EX                                              '%2Fusr%2Fshare%2FGeoIP%2FGeoIPv6.dat'
         22        FETCH_CONSTANT                                   ~12     'GEOIP_STANDARD'
         23        SEND_VAL_EX                                              ~12
         24        DO_FCALL                                      0  $13     
         25        ASSIGN                                                   !1, $13
   19    26        INIT_FCALL_BY_NAME                                       'geoip_country_code_by_addr_v6'
         27        SEND_VAR_EX                                              !1
         28        SEND_VAR_EX                                              !0
         29        DO_FCALL                                      0  $15     
         30        ASSIGN                                                   !2, $15
   21    31    >   CONCAT                                           ~17     !0, '%3Cbr%3E'
         32        CONCAT                                           ~18     ~17, !2
         33        ECHO                                                     ~18
   22    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.46 ms | 1396 KiB | 15 Q