3v4l.org

run code in 300+ PHP versions simultaneously
<!doctype html> <head> <title>Creating an image gallery</title> <style type="text/css"> ul { list-style-type: none; } li { float: left; padding:10px; margin:10px; font:bold 10px Verdana sans-serief; } img { display:block; border:1px solid #333300; margin-border:5px; } </style> </head> <body> <h2>Creating an image gallery</h2> <ul> <?php $photosDir='./picture'; $photosExt=array('gif', 'jpg','jpeg','tif', 'tiff', 'bmp','png'); $photosList=array(); if(file_exists($photosDir)) { $dp=opendir($photosDir) or die ('ERROR: Cannot open Directory'); while($file=readdir($dp)) { if($file!='.' && $file!='..') { $fileData=pathinfo($file); if(in_array($fileData['extension'],$photosExt)) { $photosList[]="$photosDir/$file"; } } } closedir($dp); } else { die('ERROR: Directory doesnot exists.'); } if(count($photosList)>0) { for($x=0; $x<count($photosList); $x++) ?> <li> <img height="150" width="200" src="<?php echo $photosList[$x];?>"/> <?php echo basename($photosList[$x]);?><br/> <?php echo round(filesize($photosList[$x])/1024) . 'KB' ;?> </li> <?php } else { die('ERROR: No image found in Directory.'); } ?> </ul> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 45
Branch analysis from position: 8
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 16
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 77
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 51
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 51
Branch analysis from position: 55
Branch analysis from position: 51
Branch analysis from position: 77
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 36
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 36
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 16
Branch analysis from position: 41
Branch analysis from position: 16
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 20
Branch analysis from position: 45
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/Gjqpe
function name:  (null)
number of ops:  80
compiled vars:  !0 = $photosDir, !1 = $photosExt, !2 = $photosList, !3 = $dp, !4 = $file, !5 = $fileData, !6 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3C%21doctype+html%3E%0A%3Chead%3E%0A%3Ctitle%3ECreating+an+image+gallery%3C%2Ftitle%3E%0A%3Cstyle+type%3D%22text%2Fcss%22%3E%0Aul%0A%7B%0A%09list-style-type%3A+none%3B%0A%7D%0Ali+%7B%0A%09float%3A+left%3B%0A%09padding%3A10px%3B%0A%09margin%3A10px%3B%0A%09font%3Abold+10px+Verdana+sans-serief%3B%0A%7D%0A%0Aimg+%7B%0A%09display%3Ablock%3B%0A%09border%3A1px+solid+%23333300%3B%0A%09margin-border%3A5px%3B%0A%7D%0A%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%3Ch2%3ECreating+an+image+gallery%3C%2Fh2%3E%0A%3Cul%3E%0A'
   27     1        ASSIGN                                                   !0, '.%2Fpicture'
   28     2        ASSIGN                                                   !1, <array>
   29     3        ASSIGN                                                   !2, <array>
   30     4        INIT_FCALL                                               'file_exists'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $10     
          7      > JMPZ                                                     $10, ->45
   32     8    >   INIT_FCALL                                               'opendir'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $11     
         11        ASSIGN                                           ~12     !3, $11
         12      > JMPNZ_EX                                         ~12     ~12, ->15
         13    > > EXIT                                                     'ERROR%3A+Cannot+open+Directory'
         14*       BOOL                                             ~12     <true>
   33    15    > > JMP                                                      ->36
   35    16    >   IS_NOT_EQUAL                                     ~13     !4, '.'
         17      > JMPZ_EX                                          ~13     ~13, ->20
         18    >   IS_NOT_EQUAL                                     ~14     !4, '..'
         19        BOOL                                             ~13     ~14
         20    > > JMPZ                                                     ~13, ->36
   36    21    >   INIT_FCALL                                               'pathinfo'
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !5, $15
   37    25        INIT_FCALL                                               'in_array'
         26        FETCH_DIM_R                                      ~17     !5, 'extension'
         27        SEND_VAL                                                 ~17
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $18     
         30      > JMPZ                                                     $18, ->36
   39    31    >   ROPE_INIT                                     3  ~21     !0
         32        ROPE_ADD                                      1  ~21     ~21, '%2F'
         33        ROPE_END                                      2  ~20     ~21, !4
         34        ASSIGN_DIM                                               !2
         35        OP_DATA                                                  ~20
   33    36    >   INIT_FCALL                                               'readdir'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                         $23     
         39        ASSIGN                                           ~24     !4, $23
         40      > JMPNZ                                                    ~24, ->16
   43    41    >   INIT_FCALL                                               'closedir'
         42        SEND_VAR                                                 !3
         43        DO_ICALL                                                 
         44      > JMP                                                      ->46
   47    45    > > EXIT                                                     'ERROR%3A+Directory+doesnot+exists.'
   50    46    >   COUNT                                            ~26     !2
         47        IS_SMALLER                                               0, ~26
         48      > JMPZ                                                     ~27, ->77
   52    49    >   ASSIGN                                                   !6, 0
         50      > JMP                                                      ->52
         51    >   PRE_INC                                                  !6
         52    >   COUNT                                            ~30     !2
         53        IS_SMALLER                                               !6, ~30
         54      > JMPNZ                                                    ~31, ->51
   54    55    >   ECHO                                                     '%3Cli%3E%0A%3Cimg+height%3D%22150%22+width%3D%22200%22+src%3D%22'
   55    56        FETCH_DIM_R                                      ~32     !2, !6
         57        ECHO                                                     ~32
         58        ECHO                                                     '%22%2F%3E%0A'
   56    59        INIT_FCALL                                               'basename'
         60        FETCH_DIM_R                                      ~33     !2, !6
         61        SEND_VAL                                                 ~33
         62        DO_ICALL                                         $34     
         63        ECHO                                                     $34
         64        ECHO                                                     '%3Cbr%2F%3E%0A'
   57    65        INIT_FCALL                                               'round'
         66        INIT_FCALL                                               'filesize'
         67        FETCH_DIM_R                                      ~35     !2, !6
         68        SEND_VAL                                                 ~35
         69        DO_ICALL                                         $36     
         70        DIV                                              ~37     $36, 1024
         71        SEND_VAL                                                 ~37
         72        DO_ICALL                                         $38     
         73        CONCAT                                           ~39     $38, 'KB'
         74        ECHO                                                     ~39
   58    75        ECHO                                                     '%3C%2Fli%3E%0A'
         76      > JMP                                                      ->78
   63    77    > > EXIT                                                     'ERROR%3A+No+image+found+in+Directory.'
   66    78    >   ECHO                                                     '%3C%2Ful%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   69    79      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.39 ms | 1409 KiB | 31 Q