3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ANDROID_MAPPING_ARRAY = array(1 => '1.0', 2 => '1.1', 3 => '1.5', 4 => '1.6', 5 => '2.0', 6 => '2.0.1', 7 => '2.1.x', 8 => '2.2.x', 9 => '2.3.2', 10 => '2.3.4', 11 => '3.0.x', 12 => '3.1.x', 13 => '3.2', 14 => '4.0.1', 15 => '4.0.4', 16 => '4.1.1', 17 => '4.2.2', 18 => '4.3', 19 => '4.4' ); $userAgent = 'ZooskAndroid/142 (Linux; U; Android 4.4; en-US; XT1030; Build/SU2-3.3)'; $agentParts = explode(',', $userAgent); $androidInfo = array(); foreach ($agentParts as $agentPart) { $partInfo = explode('/', $agentPart); if (count($partInfo) == 3) { if (strcmp($partInfo[0], 'Android') == 0) { $androidInfo[0] = $partInfo[0]; // case 81288: Lookup to map Android API version to Android OS version $versionInfo = explode('.', $partInfo[2]); if (!empty($versionInfo)) { $androidInfo[1] = $ANDROID_MAPPING_ARRAY[$versionInfo[0]]; } if (empty($androidInfo[1])) { $androidInfo[1] = $partInfo[2]; } if (count($androidInfo) > 1) { break; //return $androidInfo; } } } } print_r($androidInfo);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 51
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 51
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 50
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 50
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 50
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 46
Branch analysis from position: 41
Branch analysis from position: 50
Branch analysis from position: 50
Branch analysis from position: 51
Branch analysis from position: 51
filename:       /in/iHIWO
function name:  (null)
number of ops:  56
compiled vars:  !0 = $ANDROID_MAPPING_ARRAY, !1 = $userAgent, !2 = $agentParts, !3 = $androidInfo, !4 = $agentPart, !5 = $partInfo, !6 = $versionInfo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        ASSIGN                                                   !1, 'ZooskAndroid%2F142+%28Linux%3B+U%3B+Android+4.4%3B+en-US%3B+XT1030%3B+Build%2FSU2-3.3%29'
   27     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2C'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
   29     7        ASSIGN                                                   !3, <array>
   31     8      > FE_RESET_R                                       $12     !2, ->51
          9    > > FE_FETCH_R                                               $12, !4, ->51
   32    10    >   INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '%2F'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $13     
         14        ASSIGN                                                   !5, $13
   33    15        COUNT                                            ~15     !5
         16        IS_EQUAL                                                 ~15, 3
         17      > JMPZ                                                     ~16, ->50
   34    18    >   INIT_FCALL                                               'strcmp'
         19        FETCH_DIM_R                                      ~17     !5, 0
         20        SEND_VAL                                                 ~17
         21        SEND_VAL                                                 'Android'
         22        DO_ICALL                                         $18     
         23        IS_EQUAL                                                 $18, 0
         24      > JMPZ                                                     ~19, ->50
   35    25    >   FETCH_DIM_R                                      ~21     !5, 0
         26        ASSIGN_DIM                                               !3, 0
         27        OP_DATA                                                  ~21
   37    28        INIT_FCALL                                               'explode'
         29        SEND_VAL                                                 '.'
         30        FETCH_DIM_R                                      ~22     !5, 2
         31        SEND_VAL                                                 ~22
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !6, $23
   38    34        ISSET_ISEMPTY_CV                                 ~25     !6
         35        BOOL_NOT                                         ~26     ~25
         36      > JMPZ                                                     ~26, ->41
   39    37    >   FETCH_DIM_R                                      ~28     !6, 0
         38        FETCH_DIM_R                                      ~29     !0, ~28
         39        ASSIGN_DIM                                               !3, 1
         40        OP_DATA                                                  ~29
   41    41    >   ISSET_ISEMPTY_DIM_OBJ                         1          !3, 1
         42      > JMPZ                                                     ~30, ->46
   42    43    >   FETCH_DIM_R                                      ~32     !5, 2
         44        ASSIGN_DIM                                               !3, 1
         45        OP_DATA                                                  ~32
   44    46    >   COUNT                                            ~33     !3
         47        IS_SMALLER                                               1, ~33
         48      > JMPZ                                                     ~34, ->50
   45    49    > > JMP                                                      ->51
   31    50    > > JMP                                                      ->9
         51    >   FE_FREE                                                  $12
   53    52        INIT_FCALL                                               'print_r'
         53        SEND_VAR                                                 !3
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.73 ms | 1400 KiB | 19 Q