3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Generating Gallery Vieuw * * Generating a simple gallery overview, * with Planned !possible extended MySQL Description support * * PHP Version 5 * * @category Gallery/Images * @author Diederick Bruin DDABruin@gmail.com * @copyright 2014 http://DiederickBruin.nl/ * */ class Gallery { private $MySQL_Host, $MySQL_Database, $MySQL_User, $MySQL_Password, $MySQL_Table; public static function GenerateCSS($folder = "img/",$imgclass = "fotodiv") { foreach(glob($folder."*.{jpg,png,gif,jpeg,ico}", GLOB_BRACE) as $Path) { $Bestand = str_replace($folder, "", $Path);//stip folder $Bestand = str_replace(".", "_", $Bestand);//remove dots to genereate classname $rstring .= ".img_$Bestand:hover + .desc_$Bestand"; $rstring .= "{display: block;} \n"; /*$rstring .= ".desc_$Bestand:hover + .desc_$Bestand"; //unnuset figure out howto code $rstring .= "{display: block;} \n";*/ } return $rstring; } public static function Generate($folder = "img/",$imgclass = "fotodiv") { foreach(glob($folder."*.{jpg,png,gif,jpeg,ico}", GLOB_BRACE) as $Path) { $Bestand = str_replace($folder, "", $Path); $Bestand = str_replace(".", "_", $Bestand); $rstring .= '<div class="'.$imgclass.'">'; $rstring .= '<img class="img_'.$Bestand.'" src="'.$Path.'">'; $rstring .= '<div class="desc_'.$Bestand.'"><p>'.$Bestand.'</p></div></div>';// functie GDescription gebruiken om de beschrijving te krijgen } return $rstring; } /** * * Hieronder niet afgemaakt */ private function GDescription($Path) //private omdat hij alleen binnen de class word gebruikt om de description te vullen voor nu { //$Bestand = str_replace("img/", "", $Path); haal met path uit database $MySQL_Connect = mysqli_connect($MySQL_Host, $MySQL_User, $MySQL_Password, $MySQL_Database); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($MySQL_Connect,"SELECT * FROM `$MySQL_Table` WHERE File = '$Path'"); $rstring = mysqli_fetch_array($result); mysqli_close($MySQL_Connect); return $rstring['Description']; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q3Ws6
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E > > RETURN                                                   1

Class Gallery:
Function generatecss:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 28
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/Q3Ws6
function name:  GenerateCSS
number of ops:  31
compiled vars:  !0 = $folder, !1 = $imgclass, !2 = $Path, !3 = $Bestand, !4 = $rstring
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV_INIT                                        !0      'img%2F'
          1        RECV_INIT                                        !1      'fotodiv'
   22     2        INIT_FCALL                                               'glob'
          3        CONCAT                                           ~5      !0, '%2A.%7Bjpg%2Cpng%2Cgif%2Cjpeg%2Cico%7D'
          4        SEND_VAL                                                 ~5
          5        SEND_VAL                                                 1024
          6        DO_ICALL                                         $6      
          7      > FE_RESET_R                                       $7      $6, ->28
          8    > > FE_FETCH_R                                               $7, !2, ->28
   24     9    >   INIT_FCALL                                               'str_replace'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 ''
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !3, $8
   25    15        INIT_FCALL                                               'str_replace'
         16        SEND_VAL                                                 '.'
         17        SEND_VAL                                                 '_'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $10     
         20        ASSIGN                                                   !3, $10
   27    21        ROPE_INIT                                     4  ~13     '.img_'
         22        ROPE_ADD                                      1  ~13     ~13, !3
         23        ROPE_ADD                                      2  ~13     ~13, '%3Ahover+%2B+.desc_'
         24        ROPE_END                                      3  ~12     ~13, !3
         25        ASSIGN_OP                                     8          !4, ~12
   28    26        ASSIGN_OP                                     8          !4, '%7Bdisplay%3A+block%3B%7D+%0A'
   22    27      > JMP                                                      ->8
         28    >   FE_FREE                                                  $7
   32    29      > RETURN                                                   !4
   33    30*     > RETURN                                                   null

End of function generatecss

Function generate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 35
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 35
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/Q3Ws6
function name:  Generate
number of ops:  38
compiled vars:  !0 = $folder, !1 = $imgclass, !2 = $Path, !3 = $Bestand, !4 = $rstring
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV_INIT                                        !0      'img%2F'
          1        RECV_INIT                                        !1      'fotodiv'
   37     2        INIT_FCALL                                               'glob'
          3        CONCAT                                           ~5      !0, '%2A.%7Bjpg%2Cpng%2Cgif%2Cjpeg%2Cico%7D'
          4        SEND_VAL                                                 ~5
          5        SEND_VAL                                                 1024
          6        DO_ICALL                                         $6      
          7      > FE_RESET_R                                       $7      $6, ->35
          8    > > FE_FETCH_R                                               $7, !2, ->35
   39     9    >   INIT_FCALL                                               'str_replace'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 ''
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !3, $8
   40    15        INIT_FCALL                                               'str_replace'
         16        SEND_VAL                                                 '.'
         17        SEND_VAL                                                 '_'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $10     
         20        ASSIGN                                                   !3, $10
   42    21        CONCAT                                           ~12     '%3Cdiv+class%3D%22', !1
         22        CONCAT                                           ~13     ~12, '%22%3E'
         23        ASSIGN_OP                                     8          !4, ~13
   43    24        CONCAT                                           ~15     '%3Cimg+class%3D%22img_', !3
         25        CONCAT                                           ~16     ~15, '%22+src%3D%22'
         26        CONCAT                                           ~17     ~16, !2
         27        CONCAT                                           ~18     ~17, '%22%3E'
         28        ASSIGN_OP                                     8          !4, ~18
   44    29        CONCAT                                           ~20     '%3Cdiv+class%3D%22desc_', !3
         30        CONCAT                                           ~21     ~20, '%22%3E%3Cp%3E'
         31        CONCAT                                           ~22     ~21, !3
         32        CONCAT                                           ~23     ~22, '%3C%2Fp%3E%3C%2Fdiv%3E%3C%2Fdiv%3E'
         33        ASSIGN_OP                                     8          !4, ~23
   37    34      > JMP                                                      ->8
         35    >   FE_FREE                                                  $7
   46    36      > RETURN                                                   !4
   47    37*     > RETURN                                                   null

End of function generate

Function gdescription:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/Q3Ws6
function name:  GDescription
number of ops:  35
compiled vars:  !0 = $Path, !1 = $MySQL_Connect, !2 = $MySQL_Host, !3 = $MySQL_User, !4 = $MySQL_Password, !5 = $MySQL_Database, !6 = $result, !7 = $MySQL_Table, !8 = $rstring
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   RECV                                             !0      
   56     1        INIT_FCALL_BY_NAME                                       'mysqli_connect'
          2        SEND_VAR_EX                                              !2
          3        SEND_VAR_EX                                              !3
          4        SEND_VAR_EX                                              !4
          5        SEND_VAR_EX                                              !5
          6        DO_FCALL                                      0  $9      
          7        ASSIGN                                                   !1, $9
   57     8        INIT_FCALL_BY_NAME                                       'mysqli_connect_errno'
          9        DO_FCALL                                      0  $11     
         10      > JMPZ                                                     $11, ->15
   59    11    >   INIT_FCALL_BY_NAME                                       'mysqli_connect_error'
         12        DO_FCALL                                      0  $12     
         13        CONCAT                                           ~13     'Failed+to+connect+to+MySQL%3A+', $12
         14        ECHO                                                     ~13
   61    15    >   INIT_FCALL_BY_NAME                                       'mysqli_query'
         16        SEND_VAR_EX                                              !1
         17        ROPE_INIT                                     5  ~15     'SELECT+%2A+FROM++%60'
         18        ROPE_ADD                                      1  ~15     ~15, !7
         19        ROPE_ADD                                      2  ~15     ~15, '%60+WHERE++File+%3D+%27'
         20        ROPE_ADD                                      3  ~15     ~15, !0
         21        ROPE_END                                      4  ~14     ~15, '%27'
         22        SEND_VAL_EX                                              ~14
         23        DO_FCALL                                      0  $18     
         24        ASSIGN                                                   !6, $18
   62    25        INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         26        SEND_VAR_EX                                              !6
         27        DO_FCALL                                      0  $20     
         28        ASSIGN                                                   !8, $20
   63    29        INIT_FCALL_BY_NAME                                       'mysqli_close'
         30        SEND_VAR_EX                                              !1
         31        DO_FCALL                                      0          
   64    32        FETCH_DIM_R                                      ~23     !8, 'Description'
         33      > RETURN                                                   ~23
   65    34*     > RETURN                                                   null

End of function gdescription

End of class Gallery.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.72 ms | 1404 KiB | 17 Q