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); $previewsPath = sprintf('%s__preview.jpg',$field); } 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/8knp2
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     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 = 22
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/8knp2
function name:  __construct
number of ops:  30
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, ->22
         10    > > FE_FETCH_R                                               $11, !3, ->22
   12    11    >   INIT_FCALL                                               'sprintf'
         12        SEND_VAL                                                 '%25s_thumbnail.jpg'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !4, $12
   13    16        INIT_FCALL                                               'sprintf'
         17        SEND_VAL                                                 '%25s__preview.jpg'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !5, $14
   11    21      > JMP                                                      ->10
         22    >   FE_FREE                                                  $11
   18    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
   19    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
   21    29      > 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/8knp2
function name:  itemResolver
number of ops:  9
compiled vars:  !0 = $records, !1 = $value, !2 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   GENERATOR_CREATE                                         
   28     1        ASSIGN                                                   !0, <array>
   34     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                       ~5      $4, !1, ->7
          4    >   ASSIGN                                                   !2, ~5
   35     5        YIELD                                                    !1
   34     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   38     8      > GENERATOR_RETURN                                         

End of function itemresolver

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.33 ms | 1400 KiB | 19 Q