3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sub_arrays = [array("middle" => "array"), array(), array("external"=>"array")]; function create_array($sub) { $parent_array[] = array('first'=>"array"); foreach($sub as $s) { $parent_array[] = $s; } $parent_array[] = array('last'=>"array"); $array = array( 'template' => array( array( array(), $parent_array ), ), ); return $array; } print_r(create_array($sub_arrays));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Vahd
function name:  (null)
number of ops:  8
compiled vars:  !0 = $sub_arrays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   25     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'create_array'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function create_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/1Vahd
function name:  create_array
number of ops:  18
compiled vars:  !0 = $sub, !1 = $parent_array, !2 = $s, !3 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN_DIM                                               !1
          2        OP_DATA                                                  <array>
    7     3      > FE_RESET_R                                       $5      !0, ->8
          4    > > FE_FETCH_R                                               $5, !2, ->8
    9     5    >   ASSIGN_DIM                                               !1
          6        OP_DATA                                                  !2
    7     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $5
   12     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  <array>
   17    11        INIT_ARRAY                                       ~8      <array>
   18    12        ADD_ARRAY_ELEMENT                                ~8      !1
         13        INIT_ARRAY                                       ~9      ~8
         14        INIT_ARRAY                                       ~10     ~9, 'template'
   14    15        ASSIGN                                                   !3, ~10
   23    16      > RETURN                                                   !3
   24    17*     > RETURN                                                   null

End of function create_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.05 ms | 1014 KiB | 15 Q