3v4l.org

run code in 300+ PHP versions simultaneously
<?php $MinVersion = array( "TeachMe-App" => 000003, "TeachMe-Web" => 000001, "TeachMe-root" => 000001 ); $CurrentVersion = array( "TeachMe-App" => 000003, "TeachMe-Web" => 000000, "TeachMe-root" => 000000 ); $Client = array(); $AllowedClients = array( "App" => "TeachMe-App", "Web" => "TeachMe-Web", "Admin" => "TeachMe-root" ); $_SERVER["HTTP_USER_AGENT"] = "TeachMe-App v000003 Android 4.4.2 on generic"; $MinVersion["TeachMe-App"] = 000003; $Client["Client"] = "TeachMe-App"; if(!isset($_SERVER["HTTP_USER_AGENT"]) || array_search($Client["Client"], $AllowedClients) === FALSE) { header("X-API-Status: 40003 Invalid UserAgent"); die(); } if(strpos($_SERVER["HTTP_USER_AGENT"], "v") > 0) { //6-Stellige Versionsnummer hinter dem v auslesen $Client["Version"] = substr($_SERVER["HTTP_USER_AGENT"], strpos($_SERVER["HTTP_USER_AGENT"], "v") + 1, 6); $Client["Version"] = is_int($Client["Version"]) ? intval($Client["Version"]) : -1; } if($Client["Version"] < $MinVersion[$Client["Client"]]) { header("X-API-Status: 40004 Client-Version Too Old"); die("40004"); } print_r($Client); die("40000");
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 61
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 58
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 70
Branch analysis from position: 66
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 70
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 70
Branch analysis from position: 66
Branch analysis from position: 70
Branch analysis from position: 61
Branch analysis from position: 22
filename:       /in/8mviC
function name:  (null)
number of ops:  75
compiled vars:  !0 = $MinVersion, !1 = $CurrentVersion, !2 = $Client, !3 = $AllowedClients
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
   12     2        ASSIGN                                                   !2, <array>
   13     3        ASSIGN                                                   !3, <array>
   18     4        FETCH_W                      global              $8      '_SERVER'
          5        ASSIGN_DIM                                               $8, 'HTTP_USER_AGENT'
          6        OP_DATA                                                  'TeachMe-App+v000003+Android+4.4.2+on+generic'
   19     7        ASSIGN_DIM                                               !0, 'TeachMe-App'
          8        OP_DATA                                                  3
   21     9        ASSIGN_DIM                                               !2, 'Client'
         10        OP_DATA                                                  'TeachMe-App'
   23    11        FETCH_IS                                         ~12     '_SERVER'
         12        ISSET_ISEMPTY_DIM_OBJ                         0  ~13     ~12, 'HTTP_USER_AGENT'
         13        BOOL_NOT                                         ~14     ~13
         14      > JMPNZ_EX                                         ~14     ~14, ->22
         15    >   INIT_FCALL                                               'array_search'
         16        FETCH_DIM_R                                      ~15     !2, 'Client'
         17        SEND_VAL                                                 ~15
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $16     
         20        TYPE_CHECK                                    4  ~17     $16
         21        BOOL                                             ~14     ~17
         22    > > JMPZ                                                     ~14, ->27
   25    23    >   INIT_FCALL                                               'header'
         24        SEND_VAL                                                 'X-API-Status%3A+40003+Invalid+UserAgent'
         25        DO_ICALL                                                 
   26    26      > EXIT                                                     
   29    27    >   INIT_FCALL                                               'strpos'
         28        FETCH_R                      global              ~19     '_SERVER'
         29        FETCH_DIM_R                                      ~20     ~19, 'HTTP_USER_AGENT'
         30        SEND_VAL                                                 ~20
         31        SEND_VAL                                                 'v'
         32        DO_ICALL                                         $21     
         33        IS_SMALLER                                               0, $21
         34      > JMPZ                                                     ~22, ->61
   32    35    >   INIT_FCALL                                               'substr'
         36        FETCH_R                      global              ~24     '_SERVER'
         37        FETCH_DIM_R                                      ~25     ~24, 'HTTP_USER_AGENT'
         38        SEND_VAL                                                 ~25
         39        INIT_FCALL                                               'strpos'
         40        FETCH_R                      global              ~26     '_SERVER'
         41        FETCH_DIM_R                                      ~27     ~26, 'HTTP_USER_AGENT'
         42        SEND_VAL                                                 ~27
         43        SEND_VAL                                                 'v'
         44        DO_ICALL                                         $28     
         45        ADD                                              ~29     $28, 1
         46        SEND_VAL                                                 ~29
         47        SEND_VAL                                                 6
         48        DO_ICALL                                         $30     
         49        ASSIGN_DIM                                               !2, 'Version'
         50        OP_DATA                                                  $30
   33    51        FETCH_DIM_R                                      ~32     !2, 'Version'
         52        TYPE_CHECK                                   16          ~32
         53      > JMPZ                                                     ~33, ->58
         54    >   FETCH_DIM_R                                      ~34     !2, 'Version'
         55        CAST                                          4  ~35     ~34
         56        QM_ASSIGN                                        ~36     ~35
         57      > JMP                                                      ->59
         58    >   QM_ASSIGN                                        ~36     -1
         59    >   ASSIGN_DIM                                               !2, 'Version'
         60        OP_DATA                                                  ~36
   36    61    >   FETCH_DIM_R                                      ~37     !2, 'Version'
         62        FETCH_DIM_R                                      ~38     !2, 'Client'
         63        FETCH_DIM_R                                      ~39     !0, ~38
         64        IS_SMALLER                                               ~37, ~39
         65      > JMPZ                                                     ~40, ->70
   38    66    >   INIT_FCALL                                               'header'
         67        SEND_VAL                                                 'X-API-Status%3A+40004+Client-Version+Too+Old'
         68        DO_ICALL                                                 
         69      > EXIT                                                     '40004'
   40    70    >   INIT_FCALL                                               'print_r'
         71        SEND_VAR                                                 !2
         72        DO_ICALL                                                 
   41    73      > EXIT                                                     '40000'
         74*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.55 ms | 1400 KiB | 23 Q