3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrAgent = array( 'sony', 'symbian', 'nokia', 'samsung', 'mobile', 'windows ce', 'blackberry', 'ericsson', 'danger', 'palm', 'series60', 'palmsource', 'pocketpc', 'smartphone', 'vodafone', 'iphone', 'android', 'ipad' ); $agent = 'mozilla/5.0 (ipad; u; cpu os 4_3_2 like mac os x; en-us) applewebkit/533.17.9 (khtml, like gecko) version/5.0.2 mobile/8h7 safari/6533.18.5'; $pattern = '/((' . implode(')|(', $arrAgent) . '))/'; $found = preg_match($pattern, $agent, $matches); if (!$found) { print 'not a mobile device'; exit; } print 'device: ' . $matches[0];
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gOEbF
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arrAgent, !1 = $agent, !2 = $pattern, !3 = $found, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   23     1        ASSIGN                                                   !1, 'mozilla%2F5.0+%28ipad%3B+u%3B+cpu+os+4_3_2+like+mac+os+x%3B+en-us%29+applewebkit%2F533.17.9+%28khtml%2C+like+gecko%29+version%2F5.0.2+mobile%2F8h7+safari%2F6533.18.5'
   25     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%29%7C%28'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        CONCAT                                           ~8      '%2F%28%28', $7
          7        CONCAT                                           ~9      ~8, '%29%29%2F'
          8        ASSIGN                                                   !2, ~9
   27     9        INIT_FCALL                                               'preg_match'
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !1
         12        SEND_REF                                                 !4
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !3, $11
   28    15        BOOL_NOT                                         ~13     !3
         16      > JMPZ                                                     ~13, ->19
   29    17    >   ECHO                                                     'not+a+mobile+device'
   30    18      > EXIT                                                     
   33    19    >   FETCH_DIM_R                                      ~14     !4, 0
         20        CONCAT                                           ~15     'device%3A+', ~14
         21        ECHO                                                     ~15
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.35 ms | 1395 KiB | 17 Q