3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($html) { $matched = preg_match('/<meta[^>]*name=[^>]*viewport[^>]*>/', $html, $matches); if (!$matched) { return false; } if (preg_match('/(user-scalable=(0|no)|scale)/', $matches[0])) { // 95% of the time this indicates true mobile compatibility (cf SYS-1289) return true; } if (preg_match('/width=(\d{2}|[7-9])\d{2}/', $matches[0])) { // Specifying a width of other 700px, doesn't sound very mobile compatible (cf SYS-1289) return false; } // At this point some websites are mobile compatible, others aren't, so we'll just go with the most likely return true; } var_dump(test('<meta content="width=1024" name="viewport"/>'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/URJFi
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'test'
          2        SEND_VAL                                                 '%3Cmeta+content%3D%22width%3D1024%22+name%3D%22viewport%22%2F%3E'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/URJFi
function name:  test
number of ops:  26
compiled vars:  !0 = $html, !1 = $matched, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%3Cmeta%5B%5E%3E%5D%2Aname%3D%5B%5E%3E%5D%2Aviewport%5B%5E%3E%5D%2A%3E%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !2
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    7     7        BOOL_NOT                                         ~5      !1
          8      > JMPZ                                                     ~5, ->10
    8     9    > > RETURN                                                   <false>
   11    10    >   INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%2F%28user-scalable%3D%280%7Cno%29%7Cscale%29%2F'
         12        FETCH_DIM_R                                      ~6      !2, 0
         13        SEND_VAL                                                 ~6
         14        DO_ICALL                                         $7      
         15      > JMPZ                                                     $7, ->17
   13    16    > > RETURN                                                   <true>
   16    17    >   INIT_FCALL                                               'preg_match'
         18        SEND_VAL                                                 '%2Fwidth%3D%28%5Cd%7B2%7D%7C%5B7-9%5D%29%5Cd%7B2%7D%2F'
         19        FETCH_DIM_R                                      ~8      !2, 0
         20        SEND_VAL                                                 ~8
         21        DO_ICALL                                         $9      
         22      > JMPZ                                                     $9, ->24
   18    23    > > RETURN                                                   <false>
   22    24    > > RETURN                                                   <true>
   23    25*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.68 ms | 1403 KiB | 18 Q