3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ua = 'Mozilla/5.0 (Linux; Android 4.0; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'; $pattern = "/Android (\d).(\d)(?:.(\d))?/"; preg_match($pattern, $ua, $matches); $androidversion = array(0,0,0); if (sizeof($matches) == 0 ) { error_log("No Android version match");}if (sizeof($matches) == 1) { error_log("No major version");} if (sizeof($matches) >= 2) { $androidversion[0] = $matches[1];}if (sizeof($matches) >=3) { $androidversion[1] = $matches[2];}if (sizeof($matches) >= 4) { $androidversion[2] = $matches[3];}function isAndroidVersion($androidversiontocheck, $major, $mid, $minor){ if ($androidversiontocheck[0] == $major and $androidversiontocheck[1] == $mid and $androidversiontocheck[2] == $minor){ return True; } return False;}function isEqualorGreaterAndroidVersion($androidversiontocheck, $major, $mid, $minor){ if ($androidversiontocheck[0] < $major){ return False; }else if ($androidversiontocheck[1] < $mid){ return False; }else if ($androidversiontocheck[2] < $minor){ return False; }else{ return True; }}print (isAndroidVersion($androidversion, 4,0,0));print_r($androidversion);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 32
Branch analysis from position: 26
Branch analysis from position: 20
Branch analysis from position: 14
filename:       /in/TRVPD
function name:  (null)
number of ops:  49
compiled vars:  !0 = $ua, !1 = $pattern, !2 = $matches, !3 = $androidversion
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ASSIGN                                                   !0, 'Mozilla%2F5.0+%28Linux%3B+Android+4.0%3B+Galaxy+Nexus+Build%2FIMM76B%29+AppleWebKit%2F535.19+%28KHTML%2C+like+Gecko%29+Chrome%2F18.0.1025.133+Mobile+Safari%2F535.19'
          1        ASSIGN                                                   !1, '%2FAndroid+%28%5Cd%29.%28%5Cd%29%28%3F%3A.%28%5Cd%29%29%3F%2F'
          2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
          7        ASSIGN                                                   !3, <array>
          8        COUNT                                            ~8      !2
          9        IS_EQUAL                                                 ~8, 0
         10      > JMPZ                                                     ~9, ->14
         11    >   INIT_FCALL                                               'error_log'
         12        SEND_VAL                                                 'No+Android+version+match'
         13        DO_ICALL                                                 
         14    >   COUNT                                            ~11     !2
         15        IS_EQUAL                                                 ~11, 1
         16      > JMPZ                                                     ~12, ->20
         17    >   INIT_FCALL                                               'error_log'
         18        SEND_VAL                                                 'No+major+version'
         19        DO_ICALL                                                 
         20    >   COUNT                                            ~14     !2
         21        IS_SMALLER_OR_EQUAL                                      2, ~14
         22      > JMPZ                                                     ~15, ->26
         23    >   FETCH_DIM_R                                      ~17     !2, 1
         24        ASSIGN_DIM                                               !3, 0
         25        OP_DATA                                                  ~17
         26    >   COUNT                                            ~18     !2
         27        IS_SMALLER_OR_EQUAL                                      3, ~18
         28      > JMPZ                                                     ~19, ->32
         29    >   FETCH_DIM_R                                      ~21     !2, 2
         30        ASSIGN_DIM                                               !3, 1
         31        OP_DATA                                                  ~21
         32    >   COUNT                                            ~22     !2
         33        IS_SMALLER_OR_EQUAL                                      4, ~22
         34      > JMPZ                                                     ~23, ->38
         35    >   FETCH_DIM_R                                      ~25     !2, 3
         36        ASSIGN_DIM                                               !3, 2
         37        OP_DATA                                                  ~25
         38    >   INIT_FCALL                                               'isandroidversion'
         39        SEND_VAR                                                 !3
         40        SEND_VAL                                                 4
         41        SEND_VAL                                                 0
         42        SEND_VAL                                                 0
         43        DO_FCALL                                      0  $26     
         44        ECHO                                                     $26
         45        INIT_FCALL                                               'print_r'
         46        SEND_VAR                                                 !3
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Function isandroidversion:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 10
filename:       /in/TRVPD
function name:  isAndroidVersion
number of ops:  18
compiled vars:  !0 = $androidversiontocheck, !1 = $major, !2 = $mid, !3 = $minor
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        FETCH_DIM_R                                      ~4      !0, 0
          5        IS_EQUAL                                         ~5      !1, ~4
          6      > JMPZ_EX                                          ~5      ~5, ->10
          7    >   FETCH_DIM_R                                      ~6      !0, 1
          8        IS_EQUAL                                         ~7      !2, ~6
          9        BOOL                                             ~5      ~7
         10    > > JMPZ_EX                                          ~5      ~5, ->14
         11    >   FETCH_DIM_R                                      ~8      !0, 2
         12        IS_EQUAL                                         ~9      !3, ~8
         13        BOOL                                             ~5      ~9
         14    > > JMPZ                                                     ~5, ->16
         15    > > RETURN                                                   <true>
         16    > > RETURN                                                   <false>
         17*     > RETURN                                                   null

End of function isandroidversion

Function isequalorgreaterandroidversion:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TRVPD
function name:  isEqualorGreaterAndroidVersion
number of ops:  21
compiled vars:  !0 = $androidversiontocheck, !1 = $major, !2 = $mid, !3 = $minor
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        FETCH_DIM_R                                      ~4      !0, 0
          5        IS_SMALLER                                               ~4, !1
          6      > JMPZ                                                     ~5, ->9
          7    > > RETURN                                                   <false>
          8*       JMP                                                      ->20
          9    >   FETCH_DIM_R                                      ~6      !0, 1
         10        IS_SMALLER                                               ~6, !2
         11      > JMPZ                                                     ~7, ->14
         12    > > RETURN                                                   <false>
         13*       JMP                                                      ->20
         14    >   FETCH_DIM_R                                      ~8      !0, 2
         15        IS_SMALLER                                               ~8, !3
         16      > JMPZ                                                     ~9, ->19
         17    > > RETURN                                                   <false>
         18*       JMP                                                      ->20
         19    > > RETURN                                                   <true>
         20*     > RETURN                                                   null

End of function isequalorgreaterandroidversion

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.71 ms | 1398 KiB | 20 Q