3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP //directory to list, you choose; here we’ll just use the webroot $path = '.'; //warning: `is_dir` will need you to change to the parent directory of what you are testing //see <uk3.php.net/manual/en/function.is-dir.php#70005> for details chdir ($path); //get a directory listing $dir = array_diff (scandir ('.'), //folders / files to ignore array ('.DS_Store', 'Thumbs.db') ); //sort folders first, then by type, then alphabetically usort ($dir, create_function ('$a,$b', 'return is_dir ($a) ? (is_dir ($b) ? strnatcasecmp ($a, $b) : -1) : (is_dir ($b) ? 1 : ( strcasecmp (pathinfo ($a, PATHINFO_EXTENSION), pathinfo ($b, PATHINFO_EXTENSION)) == 0 ? strnatcasecmp ($a, $b) : strcasecmp (pathinfo ($a, PATHINFO_EXTENSION), pathinfo ($b, PATHINFO_EXTENSION)) )) ; ')); //echo to screen header ('content-type: text/plain'); print_r ($dir); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/98JB3
function name:  (null)
number of ops:  27
compiled vars:  !0 = $path, !1 = $dir
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '.'
    7     1        INIT_FCALL                                               'chdir'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   10     4        INIT_FCALL                                               'array_diff'
          5        INIT_FCALL                                               'scandir'
          6        SEND_VAL                                                 '.'
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
   12     9        SEND_VAL                                                 <array>
         10        DO_ICALL                                         $5      
   10    11        ASSIGN                                                   !1, $5
   16    12        INIT_FCALL                                               'usort'
         13        SEND_REF                                                 !1
   17    14        INIT_FCALL_BY_NAME                                       'create_function'
         15        SEND_VAL_EX                                              '%24a%2C%24b'
   18    16        SEND_VAL_EX                                              'return%09is_dir+%28%24a%29%0A%09%09%3F+%28is_dir+%28%24b%29+%3F+strnatcasecmp+%28%24a%2C+%24b%29+%3A+-1%29%0A%09%09%3A+%28is_dir+%28%24b%29+%3F+1+%3A+%28%0A%09%09%09strcasecmp+%28pathinfo+%28%24a%2C+PATHINFO_EXTENSION%29%2C+pathinfo+%28%24b%2C+PATHINFO_EXTENSION%29%29+%3D%3D+0%0A%09%09%09%3F+strnatcasecmp+%28%24a%2C+%24b%29%0A%09%09%09%3A+strcasecmp+%28pathinfo+%28%24a%2C+PATHINFO_EXTENSION%29%2C+pathinfo+%28%24b%2C+PATHINFO_EXTENSION%29%29%0A%09%09%29%29%0A%09%3B%0A'
         17        DO_FCALL                                      0  $7      
         18        SEND_VAR                                                 $7
         19        DO_ICALL                                                 
   29    20        INIT_FCALL                                               'header'
         21        SEND_VAL                                                 'content-type%3A+text%2Fplain'
         22        DO_ICALL                                                 
   30    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
   31    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.08 ms | 1396 KiB | 25 Q