3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public const PATH_TO_FILES = __DIR_.'../dpm/oc-content/uploads/28/'; public function __construct() { $item = $this->itemResolver(); $imageThumbNailsPath = []; $imagePreviewPath = []; foreach(iterator_to_array($item,true) as $field){ $thumbNailsPath = sprintf('%s_thumbnail.jpg',$field[0]); $previewsPath = sprintf('%s__preview.jpg',$field[0]); $imageThumbNailsPath[] = sprintf('%s%s',self::PATH_TO_FILES,$thumbNailsPath); $imagePreviewPath[] = sprintf('%s%s',self::PATH_TO_FILES,$previewsPath); } var_dump($imagePreviewPath); var_dump($imageThumbNailsPath); } public function itemResolver(): \Generator { // $stmt = mysqli_query($db_connect, "select pk_i_id from oc_t_item_resource ORDER by pk_i_id desc"); // $records = mysqli_fetch_all($stmt); $records = [ 0 => [0 => '4031'], 1 => [0 => '4030'], 2 => [0 => '4029'] ]; foreach($records as $record => $value){ yield $value; } } } var_dump(new Test());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFjBN
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Test'
          2        DO_FCALL                                      0          
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 40
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 40
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/fFjBN
function name:  __construct
number of ops:  48
compiled vars:  !0 = $item, !1 = $imageThumbNailsPath, !2 = $imagePreviewPath, !3 = $field, !4 = $thumbNailsPath, !5 = $previewsPath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_METHOD_CALL                                         'itemResolver'
          1        DO_FCALL                                      0  $6      
          2        ASSIGN                                                   !0, $6
    9     3        ASSIGN                                                   !1, <array>
   10     4        ASSIGN                                                   !2, <array>
   11     5        INIT_FCALL                                               'iterator_to_array'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $10     
          9      > FE_RESET_R                                       $11     $10, ->40
         10    > > FE_FETCH_R                                               $11, !3, ->40
   12    11    >   INIT_FCALL                                               'sprintf'
         12        SEND_VAL                                                 '%25s_thumbnail.jpg'
         13        FETCH_DIM_R                                      ~12     !3, 0
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !4, $13
   13    17        INIT_FCALL                                               'sprintf'
         18        SEND_VAL                                                 '%25s__preview.jpg'
         19        FETCH_DIM_R                                      ~15     !3, 0
         20        SEND_VAL                                                 ~15
         21        DO_ICALL                                         $16     
         22        ASSIGN                                                   !5, $16
   14    23        INIT_FCALL                                               'sprintf'
         24        SEND_VAL                                                 '%25s%25s'
         25        FETCH_CLASS_CONSTANT                             ~19     'PATH_TO_FILES'
         26        SEND_VAL                                                 ~19
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                         $20     
         29        ASSIGN_DIM                                               !1
         30        OP_DATA                                                  $20
   15    31        INIT_FCALL                                               'sprintf'
         32        SEND_VAL                                                 '%25s%25s'
         33        FETCH_CLASS_CONSTANT                             ~22     'PATH_TO_FILES'
         34        SEND_VAL                                                 ~22
         35        SEND_VAR                                                 !5
         36        DO_ICALL                                         $23     
         37        ASSIGN_DIM                                               !2
         38        OP_DATA                                                  $23
   11    39      > JMP                                                      ->10
         40    >   FE_FREE                                                  $11
   20    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !2
         43        DO_ICALL                                                 
   21    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                                 
   23    47      > RETURN                                                   null

End of function __construct

Function itemresolver:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 7
filename:       /in/fFjBN
function name:  itemResolver
number of ops:  9
compiled vars:  !0 = $records, !1 = $value, !2 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   GENERATOR_CREATE                                         
   30     1        ASSIGN                                                   !0, <array>
   36     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                       ~5      $4, !1, ->7
          4    >   ASSIGN                                                   !2, ~5
   37     5        YIELD                                                    !1
   36     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   40     8      > GENERATOR_RETURN                                         

End of function itemresolver

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.84 ms | 1392 KiB | 19 Q