3v4l.org

run code in 500+ PHP versions simultaneously
<?php function shouldFileBeHiddenA(string $file): bool { static $knownHiddenFiles = ['.access', '.', '.htaccess']; if(in_array($file, $knownHiddenFiles)) { return true; } if(str_ends_with($file, '.php')) { return true; } return false; } function shouldFileBeHiddenB(string $file): bool { static $knownHiddenFiles = ['.access', '.', '.htaccess']; static $knownHiddenExtensions = ['php']; if(in_array($file, $knownHiddenFiles)) { return true; } if(in_array(pathinfo($file, PATHINFO_EXTENSION), $knownHiddenExtensions)) { return true; } return false; } var_dump(shouldFileBeHiddenA('.htaccess')); var_dump(shouldFileBeHiddenA('test.php')); var_dump(shouldFileBeHiddenA('test.html')); var_dump(shouldFileBeHiddenB('.htaccess')); var_dump(shouldFileBeHiddenB('test.php')); var_dump(shouldFileBeHiddenB('test.html'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HiJHe
function name:  (null)
number of ops:  37
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL                                                   'shouldfilebehiddena'
          2        SEND_VAL                                                     '.htaccess'
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                                     
   33     6        INIT_FCALL                                                   'var_dump'
          7        INIT_FCALL                                                   'shouldfilebehiddena'
          8        SEND_VAL                                                     'test.php'
          9        DO_FCALL                                          0  $2      
         10        SEND_VAR                                                     $2
         11        DO_ICALL                                                     
   34    12        INIT_FCALL                                                   'var_dump'
         13        INIT_FCALL                                                   'shouldfilebehiddena'
         14        SEND_VAL                                                     'test.html'
         15        DO_FCALL                                          0  $4      
         16        SEND_VAR                                                     $4
         17        DO_ICALL                                                     
   36    18        INIT_FCALL                                                   'var_dump'
         19        INIT_FCALL                                                   'shouldfilebehiddenb'
         20        SEND_VAL                                                     '.htaccess'
         21        DO_FCALL                                          0  $6      
         22        SEND_VAR                                                     $6
         23        DO_ICALL                                                     
   37    24        INIT_FCALL                                                   'var_dump'
         25        INIT_FCALL                                                   'shouldfilebehiddenb'
         26        SEND_VAL                                                     'test.php'
         27        DO_FCALL                                          0  $8      
         28        SEND_VAR                                                     $8
         29        DO_ICALL                                                     
   38    30        INIT_FCALL                                                   'var_dump'
         31        INIT_FCALL                                                   'shouldfilebehiddenb'
         32        SEND_VAL                                                     'test.html'
         33        DO_FCALL                                          0  $10     
         34        SEND_VAR                                                     $10
         35        DO_ICALL                                                     
         36      > RETURN                                                       1

Function shouldfilebehiddena:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HiJHe
function name:  shouldFileBeHiddenA
number of ops:  14
compiled vars:  !0 = $file, !1 = $knownHiddenFiles
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        BIND_STATIC                                                  !1
    6     2        FRAMELESS_ICALL_2                in_array            ~2      !0, !1
          3      > JMPZ                                                         ~2, ->5
    7     4    > > RETURN                                                       <true>
   10     5    >   INIT_FCALL                                                   'str_ends_with'
          6        SEND_VAR                                                     !0
          7        SEND_VAL                                                     '.php'
          8        DO_ICALL                                             $3      
          9      > JMPZ                                                         $3, ->11
   11    10    > > RETURN                                                       <true>
   14    11    > > RETURN                                                       <false>
   15    12*       VERIFY_RETURN_TYPE                                           
         13*     > RETURN                                                       null

End of function shouldfilebehiddena

Function shouldfilebehiddenb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HiJHe
function name:  shouldFileBeHiddenB
number of ops:  16
compiled vars:  !0 = $file, !1 = $knownHiddenFiles, !2 = $knownHiddenExtensions
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        BIND_STATIC                                                  !1
   19     2        BIND_STATIC                                                  !2
   21     3        FRAMELESS_ICALL_2                in_array            ~3      !0, !1
          4      > JMPZ                                                         ~3, ->6
   22     5    > > RETURN                                                       <true>
   25     6    >   INIT_FCALL                                                   'pathinfo'
          7        SEND_VAR                                                     !0
          8        SEND_VAL                                                     4
          9        DO_ICALL                                             $4      
         10        FRAMELESS_ICALL_2                in_array            ~5      $4, !2
         11      > JMPZ                                                         ~5, ->13
   26    12    > > RETURN                                                       <true>
   29    13    > > RETURN                                                       <false>
   30    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function shouldfilebehiddenb

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
175.81 ms | 1875 KiB | 22 Q