3v4l.org

run code in 300+ PHP versions simultaneously
<?php // repertoire a scanner : $dir= "/var/www/stock/downloads"; // comparateur de date function dateComparator($a, $b) { if ($a['date_modification'] == $b['date_modification']) return 0; return ($b['date_modification'] < $a['date_modification']) ? -1 : 1; } // scan du repertoire $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST); $fichiers=array(); foreach ($iterator as $path) { // si il s'agit d'un fichier if ($path->isFile()) { $nom = pathinfo($path->__toString(), PATHINFO_BASENAME); if ($nom != '`^\.`' ) { // on cree une matrice d'informations sur le fichier $fichiers[]= array( "nom" => $nom, "date_modification" => filemtime($path) ); } } } // tri par date usort($fichiers, 'dateComparator'); $fichiers = array_slice($fichiers, 0, 20); // affichage du tableau de fichiers apres tri par date echo "<h3>Derniers fichiers téléchargés : </h3>"; echo "<hr/>"; foreach($fichiers as $key => $item) { echo "[".$key."] ".date("d/m/Y H:i:s", $item['date_modification'])." | ".$item['nom']."<br/>"; } echo "<hr/>"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 32
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 31
Branch analysis from position: 31
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 62
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 62
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 62
Branch analysis from position: 32
filename:       /in/7FlAv
function name:  (null)
number of ops:  65
compiled vars:  !0 = $dir, !1 = $iterator, !2 = $fichiers, !3 = $path, !4 = $nom, !5 = $item, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%2Fvar%2Fwww%2Fstock%2Fdownloads'
   13     1        NEW                                              $8      'RecursiveIteratorIterator'
   14     2        NEW                                              $9      'RecursiveDirectoryIterator'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $9
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0          
   13     8        ASSIGN                                                   !1, $8
   16     9        ASSIGN                                                   !2, <array>
   17    10      > FE_RESET_R                                       $14     !1, ->32
         11    > > FE_FETCH_R                                               $14, !3, ->32
   19    12    >   INIT_METHOD_CALL                                         !3, 'isFile'
         13        DO_FCALL                                      0  $15     
         14      > JMPZ                                                     $15, ->31
   20    15    >   INIT_FCALL                                               'pathinfo'
         16        INIT_METHOD_CALL                                         !3, '__toString'
         17        DO_FCALL                                      0  $16     
         18        SEND_VAR                                                 $16
         19        SEND_VAL                                                 2
         20        DO_ICALL                                         $17     
         21        ASSIGN                                                   !4, $17
   21    22        IS_NOT_EQUAL                                             !4, '%60%5E%5C.%60'
         23      > JMPZ                                                     ~19, ->31
   24    24    >   INIT_ARRAY                                       ~21     !4, 'nom'
   25    25        INIT_FCALL                                               'filemtime'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $22     
         28        ADD_ARRAY_ELEMENT                                ~21     $22, 'date_modification'
   23    29        ASSIGN_DIM                                               !2
   25    30        OP_DATA                                                  ~21
   17    31    > > JMP                                                      ->11
         32    >   FE_FREE                                                  $14
   33    33        INIT_FCALL                                               'usort'
         34        SEND_REF                                                 !2
         35        SEND_VAL                                                 'dateComparator'
         36        DO_ICALL                                                 
   34    37        INIT_FCALL                                               'array_slice'
         38        SEND_VAR                                                 !2
         39        SEND_VAL                                                 0
         40        SEND_VAL                                                 20
         41        DO_ICALL                                         $24     
         42        ASSIGN                                                   !2, $24
   37    43        ECHO                                                     '%3Ch3%3EDerniers+fichiers+t%C3%A9l%C3%A9charg%C3%A9s+%3A+%3C%2Fh3%3E'
   38    44        ECHO                                                     '%3Chr%2F%3E'
   40    45      > FE_RESET_R                                       $26     !2, ->62
         46    > > FE_FETCH_R                                       ~27     $26, !5, ->62
         47    >   ASSIGN                                                   !6, ~27
   41    48        CONCAT                                           ~29     '%5B', !6
         49        CONCAT                                           ~30     ~29, '%5D+'
         50        INIT_FCALL                                               'date'
         51        SEND_VAL                                                 'd%2Fm%2FY+H%3Ai%3As'
         52        FETCH_DIM_R                                      ~31     !5, 'date_modification'
         53        SEND_VAL                                                 ~31
         54        DO_ICALL                                         $32     
         55        CONCAT                                           ~33     ~30, $32
         56        CONCAT                                           ~34     ~33, '+%7C+'
         57        FETCH_DIM_R                                      ~35     !5, 'nom'
         58        CONCAT                                           ~36     ~34, ~35
         59        CONCAT                                           ~37     ~36, '%3Cbr%2F%3E'
         60        ECHO                                                     ~37
   40    61      > JMP                                                      ->46
         62    >   FE_FREE                                                  $26
   43    63        ECHO                                                     '%3Chr%2F%3E'
   45    64      > RETURN                                                   1

Function datecomparator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7FlAv
function name:  dateComparator
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        FETCH_DIM_R                                      ~2      !0, 'date_modification'
          3        FETCH_DIM_R                                      ~3      !1, 'date_modification'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->7
          6    > > RETURN                                                   0
    9     7    >   FETCH_DIM_R                                      ~5      !1, 'date_modification'
          8        FETCH_DIM_R                                      ~6      !0, 'date_modification'
          9        IS_SMALLER                                               ~5, ~6
         10      > JMPZ                                                     ~7, ->13
         11    >   QM_ASSIGN                                        ~8      -1
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~8      1
         14    > > RETURN                                                   ~8
   10    15*     > RETURN                                                   null

End of function datecomparator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.5 ms | 1404 KiB | 23 Q