3v4l.org

run code in 300+ PHP versions simultaneously
<?php $oses = array( 'Windows 95' => array('win95', 'windows 95'), 'Windows 98' => array('win98', 'windows 98'), 'Windows CE' => 'windows ce', 'Windows ME' => array('windows 9x 4.90', 'windows me'), 'Windows NT' => array('winnt4.0', 'windows nt 4.0'), 'Windows 2000' => array('winnt5.0', 'windows nt 5.0'), 'Windows XP' => array('winnt5.1', 'windows nt 5.1'), 'Windows 2003 Server' => 'windows nt 5.2', 'Windows Vista' => 'windows nt 6.0', 'Windows 7' => 'windows nt 6.1', 'Windows 8' => 'windows nt 6.2', 'Windows Unatended' => 'windows', 'iOS' => array('iphone', 'ipad', 'ipod'), 'Mac OS X 10.0' => 'mac os x 10.0', 'Mac OS X 10.1' => 'mac os x 10.1', 'Mac OS X 10.2' => 'mac os x 10.2', 'Mac OS X 10.3' => 'mac os x 10.3', 'Mac OS X 10.4' => 'mac os x 10.4', 'Mac OS X 10.5' => 'mac os x 10.5', 'Mac OS X 10.6' => 'mac os x 10.6', 'Mac OS X 10.7' => 'mac os x 10.7', 'Mac OS X 10.8' => 'mac os x 10.8', 'Mac OS X 10.9' => 'mac os x 10.9', 'Mac OS X' => 'mac os x', 'Macintosh' => array('powerpc', 'macintosh'), 'Android 5.x' => 'android 5', 'Android 4.x' => 'android 4', 'Android 3.x' => 'android 3', 'Android 2.x' => 'android 2', 'Android 1.x' => 'android 1', 'Android' => 'android', 'Linux' => 'linux', 'Free BSD' => 'freebsd', 'Net BSD' => 'netbsd', 'Open BSD' => 'openbsd', 'Sun OS' => 'sunos', 'Symbian' => 'symbian', 'Tapatalk' => 'tapatalk', ); #$useragent = strtolower('Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3'); $useragent = strtolower('Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)'); #$useragent = strtolower('Mozilla/4.0 (compatible; MSIE 4.0; Windows 95; .NET CLR 1.1.4322; .NET CLR 2.0.50727'); foreach ($oses as $os => $identificator) { if (is_array($identificator)) { #user_error($useragent, E_USER_NOTICE); foreach ($identificator as $ident) { user_error($ident, E_USER_NOTICE); if (preg_match("#$ident#i", $useragent)) { user_error('FOUND!', E_USER_NOTICE); $browser['os'] = $os; break 2; } } } else { user_error($identificator, E_USER_NOTICE); if (preg_match("#$identificator#i", $useragent)) { $browser['os'] = $os; break; } } } user_error($browser['os'], E_USER_NOTICE); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 51
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 51
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 35
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 33
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 33
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
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: 32
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 33
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 50
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
Branch analysis from position: 50
Branch analysis from position: 51
Branch analysis from position: 51
filename:       /in/c6mKK
function name:  (null)
number of ops:  58
compiled vars:  !0 = $oses, !1 = $useragent, !2 = $identificator, !3 = $os, !4 = $ident, !5 = $browser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   44     1        INIT_FCALL                                               'strtolower'
          2        SEND_VAL                                                 'Mozilla%2F5.0+%28iPhone%3B+U%3B+CPU+iPhone+OS+4_1+like+Mac+OS+X%3B+en-us%29+AppleWebKit%2F532.9+%28KHTML%2C+like+Gecko%29+Version%2F4.0.5+Mobile%2F8B117+Safari%2F6531.22.7+%28compatible%3B+Googlebot-Mobile%2F2.1%3B+%2Bhttp%3A%2F%2Fwww.google.com%2Fbot.html%29'
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
   47     5      > FE_RESET_R                                       $9      !0, ->51
          6    > > FE_FETCH_R                                       ~10     $9, !2, ->51
          7    >   ASSIGN                                                   !3, ~10
   49     8        TYPE_CHECK                                  128          !2
          9      > JMPZ                                                     ~12, ->35
   52    10    > > FE_RESET_R                                       $13     !2, ->33
         11    > > FE_FETCH_R                                               $13, !4, ->33
   54    12    >   INIT_FCALL                                               'user_error'
         13        SEND_VAR                                                 !4
         14        SEND_VAL                                                 1024
         15        DO_ICALL                                                 
   55    16        INIT_FCALL                                               'preg_match'
         17        ROPE_INIT                                     3  ~16     '%23'
         18        ROPE_ADD                                      1  ~16     ~16, !4
         19        ROPE_END                                      2  ~15     ~16, '%23i'
         20        SEND_VAL                                                 ~15
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $18     
         23      > JMPZ                                                     $18, ->32
   57    24    >   INIT_FCALL                                               'user_error'
         25        SEND_VAL                                                 'FOUND%21'
         26        SEND_VAL                                                 1024
         27        DO_ICALL                                                 
   58    28        ASSIGN_DIM                                               !5, 'os'
         29        OP_DATA                                                  !3
   59    30        FE_FREE                                                  $13
         31      > JMP                                                      ->51
   52    32    > > JMP                                                      ->11
         33    >   FE_FREE                                                  $13
         34      > JMP                                                      ->50
   65    35    >   INIT_FCALL                                               'user_error'
         36        SEND_VAR                                                 !2
         37        SEND_VAL                                                 1024
         38        DO_ICALL                                                 
   66    39        INIT_FCALL                                               'preg_match'
         40        ROPE_INIT                                     3  ~23     '%23'
         41        ROPE_ADD                                      1  ~23     ~23, !2
         42        ROPE_END                                      2  ~22     ~23, '%23i'
         43        SEND_VAL                                                 ~22
         44        SEND_VAR                                                 !1
         45        DO_ICALL                                         $25     
         46      > JMPZ                                                     $25, ->50
   68    47    >   ASSIGN_DIM                                               !5, 'os'
         48        OP_DATA                                                  !3
   69    49      > JMP                                                      ->51
   47    50    > > JMP                                                      ->6
         51    >   FE_FREE                                                  $9
   74    52        INIT_FCALL                                               'user_error'
         53        FETCH_DIM_R                                      ~27     !5, 'os'
         54        SEND_VAL                                                 ~27
         55        SEND_VAL                                                 1024
         56        DO_ICALL                                                 
   76    57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.28 ms | 1403 KiB | 21 Q