3v4l.org

run code in 300+ PHP versions simultaneously
<?php $base = '/some/dir'; $path = '/foo/bar'; $protect = array('/bar','/foo','/bob'); foreach($protect as $needle) { echo "Checking for $needle in $path:\n"; if( strpos($path,$needle) !==FALSE ) { echo "path contains the needle"; if( strcmp( $needle, $path ) > 0 ) { echo "The path is a subfolder inside the needle"; } else { echo "The path isn't a subfolder inside the needle"; } } else { echo "The path doesn't contain the needle"; } echo "\n\n"; } echo "Check completed"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 31
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 31
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 28
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/clZo0
function name:  (null)
number of ops:  34
compiled vars:  !0 = $base, !1 = $path, !2 = $protect, !3 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2Fsome%2Fdir'
    4     1        ASSIGN                                                   !1, '%2Ffoo%2Fbar'
    5     2        ASSIGN                                                   !2, <array>
    7     3      > FE_RESET_R                                       $7      !2, ->31
          4    > > FE_FETCH_R                                               $7, !3, ->31
    8     5    >   ROPE_INIT                                     5  ~9      'Checking+for+'
          6        ROPE_ADD                                      1  ~9      ~9, !3
          7        ROPE_ADD                                      2  ~9      ~9, '+in+'
          8        ROPE_ADD                                      3  ~9      ~9, !1
          9        ROPE_END                                      4  ~8      ~9, '%3A%0A'
         10        ECHO                                                     ~8
   10    11        INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $12     
         15        TYPE_CHECK                                  1018          $12
         16      > JMPZ                                                     ~13, ->28
   11    17    >   ECHO                                                     'path+contains+the+needle'
   12    18        INIT_FCALL                                               'strcmp'
         19        SEND_VAR                                                 !3
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $14     
         22        IS_SMALLER                                               0, $14
         23      > JMPZ                                                     ~15, ->26
   13    24    >   ECHO                                                     'The+path+is+a+subfolder+inside+the+needle'
         25      > JMP                                                      ->27
   15    26    >   ECHO                                                     'The+path+isn%27t+a+subfolder+inside+the+needle'
         27    > > JMP                                                      ->29
   18    28    >   ECHO                                                     'The+path+doesn%27t+contain+the+needle'
   20    29    >   ECHO                                                     '%0A%0A'
    7    30      > JMP                                                      ->4
         31    >   FE_FREE                                                  $7
   22    32        ECHO                                                     'Check+completed'
   23    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.92 ms | 1400 KiB | 17 Q