3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class GalleryHelper { public static function getGalleryImages($type, $selectedFolder): array { $galleryImages = []; $folderToEquipmentImages = "images/equipmentmanager/$type/"; if($type === 'packages'){ $folderToEquipmentImages .= 'galleries/'; } $imgsPath = JPATH_SITE . '/' . $folderToEquipmentImages . $selectedFolder; if (is_dir($imgsPath)) { $allowedExtensions = ['jpg', 'jpeg', 'png', 'gif']; // see https://www.regular-expressions.info/modifiers.html and here is a sub-demonstration: https://3v4l.org/fKXcL $filter = "\.(?:(?i)" . implode('|', $allowedExtensions) . ")$"; // Prepend the folder path to the filenames (enjoying PHP7.4's arrow function syntax) $galleryImages = array_map( fn($img) => \JUri::base() . $folderToEquipmentImages . $selectedFolder . '/' . $img, Folder::files($imgsPath, $filter, false, false, $exclude = ['index.html']) ); } return $galleryImages; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vc8Cq
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   1

Class GalleryHelper:
Function getgalleryimages:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 43
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 10
filename:       /in/vc8Cq
function name:  getGalleryImages
number of ops:  47
compiled vars:  !0 = $type, !1 = $selectedFolder, !2 = $galleryImages, !3 = $folderToEquipmentImages, !4 = $imgsPath, !5 = $allowedExtensions, !6 = $filter, !7 = $exclude
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN                                                   !2, <array>
    7     3        ROPE_INIT                                     3  ~10     'images%2Fequipmentmanager%2F'
          4        ROPE_ADD                                      1  ~10     ~10, !0
          5        ROPE_END                                      2  ~9      ~10, '%2F'
          6        ASSIGN                                                   !3, ~9
    8     7        IS_IDENTICAL                                             !0, 'packages'
          8      > JMPZ                                                     ~13, ->10
    9     9    >   ASSIGN_OP                                     8          !3, 'galleries%2F'
   12    10    >   FETCH_CONSTANT                                   ~15     'JPATH_SITE'
         11        CONCAT                                           ~16     ~15, '%2F'
         12        CONCAT                                           ~17     ~16, !3
         13        CONCAT                                           ~18     ~17, !1
         14        ASSIGN                                                   !4, ~18
   13    15        INIT_FCALL                                               'is_dir'
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                         $20     
         18      > JMPZ                                                     $20, ->43
   15    19    >   ASSIGN                                                   !5, <array>
   17    20        INIT_FCALL                                               'implode'
         21        SEND_VAL                                                 '%7C'
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                         $22     
         24        CONCAT                                           ~23     '%5C.%28%3F%3A%28%3Fi%29', $22
         25        CONCAT                                           ~24     ~23, '%29%24'
         26        ASSIGN                                                   !6, ~24
   20    27        INIT_FCALL                                               'array_map'
   21    28        DECLARE_LAMBDA_FUNCTION                          ~26     [0]
         29        BIND_LEXICAL                                             ~26, !3
         30        BIND_LEXICAL                                             ~26, !1
         31        SEND_VAL                                                 ~26
   22    32        INIT_STATIC_METHOD_CALL                                  'Folder', 'files'
         33        SEND_VAR_EX                                              !4
         34        SEND_VAR_EX                                              !6
         35        SEND_VAL_EX                                              <false>
         36        SEND_VAL_EX                                              <false>
         37        ASSIGN                                           ~27     !7, <array>
         38        SEND_VAL_EX                                              ~27
         39        DO_FCALL                                      0  $28     
         40        SEND_VAR                                                 $28
   20    41        DO_ICALL                                         $29     
         42        ASSIGN                                                   !2, $29
   25    43    >   VERIFY_RETURN_TYPE                                       !2
         44      > RETURN                                                   !2
   26    45*       VERIFY_RETURN_TYPE                                       
         46*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vc8Cq
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $img, !1 = $folderToEquipmentImages, !2 = $selectedFolder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        INIT_STATIC_METHOD_CALL                                  'JUri', 'base'
          4        DO_FCALL                                      0  $3      
          5        CONCAT                                           ~4      $3, !1
          6        CONCAT                                           ~5      ~4, !2
          7        CONCAT                                           ~6      ~5, '%2F'
          8        CONCAT                                           ~7      ~6, !0
          9      > RETURN                                                   ~7
         10*     > RETURN                                                   null

End of Dynamic Function 0

End of function getgalleryimages

End of class GalleryHelper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.18 ms | 1012 KiB | 16 Q