3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getUserAgent() { $agent = null; if ( empty($agent) ) { $agent = $_SERVER['HTTP_USER_AGENT']; if ( stripos($agent, 'Firefox') !== false ) { $agent = 'firefox'; } elseif ( stripos($agent, 'MSIE') !== false ) { $agent = 'ie'; } elseif ( stripos($agent, 'iPad') !== false ) { $agent = 'ipad'; } elseif ( stripos($agent, 'Android') !== false ) { $agent = 'android'; } elseif ( stripos($agent, 'Chrome') !== false ) { $agent = 'chrome'; } elseif ( stripos($agent, 'Safari') !== false ) { $agent = 'safari'; } elseif ( stripos($agent, 'AIR') !== false ) { $agent = 'air'; } elseif ( stripos($agent, 'Fluid') !== false ) { $agent = 'fluid'; } } return $agent; } echo getUserAgent(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hIP3g
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'getuseragent'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   35     3      > RETURN                                                   1

Function getuseragent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 69
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 54
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 62
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 69
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
Branch analysis from position: 69
filename:       /in/hIP3g
function name:  getUserAgent
number of ops:  71
compiled vars:  !0 = $agent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, null
    7     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~2, ->69
    8     3    >   FETCH_R                      global              ~3      '_SERVER'
          4        FETCH_DIM_R                                      ~4      ~3, 'HTTP_USER_AGENT'
          5        ASSIGN                                                   !0, ~4
   10     6        INIT_FCALL                                               'stripos'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'Firefox'
          9        DO_ICALL                                         $6      
         10        TYPE_CHECK                                  1018          $6
         11      > JMPZ                                                     ~7, ->14
   11    12    >   ASSIGN                                                   !0, 'firefox'
         13      > JMP                                                      ->69
   12    14    >   INIT_FCALL                                               'stripos'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 'MSIE'
         17        DO_ICALL                                         $9      
         18        TYPE_CHECK                                  1018          $9
         19      > JMPZ                                                     ~10, ->22
   13    20    >   ASSIGN                                                   !0, 'ie'
         21      > JMP                                                      ->69
   14    22    >   INIT_FCALL                                               'stripos'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 'iPad'
         25        DO_ICALL                                         $12     
         26        TYPE_CHECK                                  1018          $12
         27      > JMPZ                                                     ~13, ->30
   15    28    >   ASSIGN                                                   !0, 'ipad'
         29      > JMP                                                      ->69
   16    30    >   INIT_FCALL                                               'stripos'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 'Android'
         33        DO_ICALL                                         $15     
         34        TYPE_CHECK                                  1018          $15
         35      > JMPZ                                                     ~16, ->38
   17    36    >   ASSIGN                                                   !0, 'android'
         37      > JMP                                                      ->69
   18    38    >   INIT_FCALL                                               'stripos'
         39        SEND_VAR                                                 !0
         40        SEND_VAL                                                 'Chrome'
         41        DO_ICALL                                         $18     
         42        TYPE_CHECK                                  1018          $18
         43      > JMPZ                                                     ~19, ->46
   19    44    >   ASSIGN                                                   !0, 'chrome'
         45      > JMP                                                      ->69
   20    46    >   INIT_FCALL                                               'stripos'
         47        SEND_VAR                                                 !0
         48        SEND_VAL                                                 'Safari'
         49        DO_ICALL                                         $21     
         50        TYPE_CHECK                                  1018          $21
         51      > JMPZ                                                     ~22, ->54
   21    52    >   ASSIGN                                                   !0, 'safari'
         53      > JMP                                                      ->69
   22    54    >   INIT_FCALL                                               'stripos'
         55        SEND_VAR                                                 !0
         56        SEND_VAL                                                 'AIR'
         57        DO_ICALL                                         $24     
         58        TYPE_CHECK                                  1018          $24
         59      > JMPZ                                                     ~25, ->62
   23    60    >   ASSIGN                                                   !0, 'air'
         61      > JMP                                                      ->69
   24    62    >   INIT_FCALL                                               'stripos'
         63        SEND_VAR                                                 !0
         64        SEND_VAL                                                 'Fluid'
         65        DO_ICALL                                         $27     
         66        TYPE_CHECK                                  1018          $27
         67      > JMPZ                                                     ~28, ->69
   25    68    >   ASSIGN                                                   !0, 'fluid'
   30    69    > > RETURN                                                   !0
   31    70*     > RETURN                                                   null

End of function getuseragent

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.28 ms | 1407 KiB | 16 Q