3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __construct() { $item = $this->itemResolver(); foreach(iterator_to_array($item,true) as $number => $value){ var_dump($value); } } 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/MoHjI
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     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 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/MoHjI
function name:  __construct
number of ops:  16
compiled vars:  !0 = $item, !1 = $value, !2 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_METHOD_CALL                                         'itemResolver'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
    8     3        INIT_FCALL                                               'iterator_to_array'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $5      
          7      > FE_RESET_R                                       $6      $5, ->14
          8    > > FE_FETCH_R                                       ~7      $6, !1, ->14
          9    >   ASSIGN                                                   !2, ~7
    9    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
    8    13      > JMP                                                      ->8
         14    >   FE_FREE                                                  $6
   13    15      > 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/MoHjI
function name:  itemResolver
number of ops:  9
compiled vars:  !0 = $records, !1 = $value, !2 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   GENERATOR_CREATE                                         
   20     1        ASSIGN                                                   !0, <array>
   26     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                       ~5      $4, !1, ->7
          4    >   ASSIGN                                                   !2, ~5
   27     5        YIELD                                                    !1
   26     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   30     8      > GENERATOR_RETURN                                         

End of function itemresolver

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.83 ms | 1400 KiB | 17 Q