3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function rec($dir, $depth) { $d = dir($dir); if (!$d) return; while ($entry = $d->read()) { if ($entry == '.' || $entry == '..') continue; echo $depth . $entry . "\n"; if (is_dir($dir . '/' . $entry)) { //rec($dir . '/' . $entry, $depth . " "); } } } rec('/', '');
based on BXF02
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/XAPDP
function name:  (null)
number of ops:  6
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  14     1        INIT_FCALL                                               'rec'
         2        SEND_VAL                                                 '%2F'
         3        SEND_VAL                                                 ''
         4        DO_FCALL                                      0          
         5      > RETURN                                                   1

Function rec:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
Jump found. Position 1 = -2
Branch analysis from position: 9
Jump found. Position 1 = 25
Branch analysis from position: 25
Jump found. Position 1 = 29, Position 2 = 10
Branch analysis from position: 29
Jump found. Position 1 = -2
Branch analysis from position: 10
Jump found. Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
Jump found. Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
Jump found. Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 16
Jump found. Position 1 = 25, Position 2 = 25
Branch analysis from position: 25
Branch analysis from position: 25
Branch analysis from position: 14
filename:       /in/XAPDP
function name:  rec
number of ops:  30
compiled vars:  !0 = $dir, !1 = $depth, !2 = $d, !3 = $entry
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
         1        RECV                                             !1      
   4     2        INIT_FCALL                                               'dir'
         3        SEND_VAR                                                 !0
         4        DO_ICALL                                         $4      
         5        ASSIGN                                                   !2, $4
   5     6        BOOL_NOT                                         ~6      !2
         7      > JMPZ                                                     ~6, ->9
         8    > > RETURN                                                   null
   6     9    > > JMP                                                      ->25
   7    10    >   IS_EQUAL                                         ~7      !3, '.'
        11      > JMPNZ_EX                                         ~7      ~7, ->14
        12    >   IS_EQUAL                                         ~8      !3, '..'
        13        BOOL                                             ~7      ~8
        14    > > JMPZ                                                     ~7, ->16
        15    > > JMP                                                      ->25
   8    16    >   CONCAT                                           ~9      !1, !3
        17        CONCAT                                           ~10     ~9, '%0A'
        18        ECHO                                                     ~10
   9    19        INIT_FCALL                                               'is_dir'
        20        CONCAT                                           ~11     !0, '%2F'
        21        CONCAT                                           ~12     ~11, !3
        22        SEND_VAL                                                 ~12
        23        DO_ICALL                                         $13     
        24      > JMPZ                                                     $13, ->25
   6    25    >   INIT_METHOD_CALL                                         !2, 'read'
        26        DO_FCALL                                      0  $14     
        27        ASSIGN                                           $15     !3, $14
        28      > JMPNZ                                                    $15, ->10
  13    29    > > RETURN                                                   null

End of function rec

Generated using Vulcan Logic Dumper, using php 7.2.0