3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'one' => range(1,3), range('a', 'c'), 'moo' => array( 'baa' => array('A', 'C'), ), ); function transform(array $array) { foreach ($array as $key => $value) { if (is_array($value)) { yield from transform($value); } else { yield 'JAM_' . $key => $value; } } } $a = iterator_to_array(transform($array)); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aYVMF
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 3
          3        DO_ICALL                                         $2      
          4        INIT_ARRAY                                       ~3      $2, 'one'
    5     5        INIT_FCALL                                               'range'
          6        SEND_VAL                                                 'a'
          7        SEND_VAL                                                 'c'
          8        DO_ICALL                                         $4      
          9        ADD_ARRAY_ELEMENT                                ~3      $4
    4    10        ADD_ARRAY_ELEMENT                                ~3      <array>, 'moo'
    3    11        ASSIGN                                                   !0, ~3
   21    12        INIT_FCALL                                               'iterator_to_array'
         13        INIT_FCALL                                               'transform'
         14        SEND_VAR                                                 !0
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                         $7      
         18        ASSIGN                                                   !1, $7
   22    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function transform:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 16
filename:       /in/aYVMF
function name:  transform
number of ops:  18
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   12     2      > FE_RESET_R                                       $3      !0, ->16
          3    > > FE_FETCH_R                                       ~4      $3, !1, ->16
          4    >   ASSIGN                                                   !2, ~4
   13     5        TYPE_CHECK                                  128          !1
          6      > JMPZ                                                     ~6, ->13
   14     7    >   INIT_FCALL_BY_NAME                                       'transform'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $7      
         10        YIELD_FROM                                       ~8      $7
         11        FREE                                                     ~8
         12      > JMP                                                      ->15
   16    13    >   CONCAT                                           ~9      'JAM_', !2
         14        YIELD                                                    !1, ~9
   12    15    > > JMP                                                      ->3
         16    >   FE_FREE                                                  $3
   19    17      > GENERATOR_RETURN                                         

End of function transform

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.62 ms | 1403 KiB | 20 Q