3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fruit = array(); $fruit[] = array('id' => 1, 'name' => 'Banana 1'); $fruit[] = array('id' => 1, 'name' => 'Pear 1'); $fruit[] = array('id' => 1, 'name' => 'Mango 1'); $fruit[] = array('id' => 2, 'name' => 'Banana 2'); $fruit[] = array('id' => 2, 'name' => 'Pear 2'); $fruit[] = array('id' => 2, 'name' => 'Mango 2'); $render = array(); $render = array_merge($render, array('fruit' => $fruit)); $render = array_merge_recursive($render, array('pieces' => get_pieces(1))); $render = array_merge($render, array('fruit' => $fruit)); $render = array_merge_recursive($render, array('pieces' => get_pieces(2))); function get_pieces($id) { $pieces = array(); switch ($id) { case 1: $pieces[] = array('number' => 1); $pieces[] = array('number' => 2); break; case 2: $pieces[] = array('number' => 3); $pieces[] = array('number' => 4, 'qwerty' => 1); break; } return $pieces; } var_dump($render);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBZDo
function name:  (null)
number of ops:  48
compiled vars:  !0 = $fruit, !1 = $render
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  <array>
    6     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  <array>
    7     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  <array>
    9     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  <array>
   10     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  <array>
   11    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  <array>
   13    13        ASSIGN                                                   !1, <array>
   15    14        INIT_FCALL                                               'array_merge'
         15        SEND_VAR                                                 !1
         16        INIT_ARRAY                                       ~10     !0, 'fruit'
         17        SEND_VAL                                                 ~10
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !1, $11
   16    20        INIT_FCALL                                               'array_merge_recursive'
         21        SEND_VAR                                                 !1
         22        INIT_FCALL_BY_NAME                                       'get_pieces'
         23        SEND_VAL_EX                                              1
         24        DO_FCALL                                      0  $13     
         25        INIT_ARRAY                                       ~14     $13, 'pieces'
         26        SEND_VAL                                                 ~14
         27        DO_ICALL                                         $15     
         28        ASSIGN                                                   !1, $15
   18    29        INIT_FCALL                                               'array_merge'
         30        SEND_VAR                                                 !1
         31        INIT_ARRAY                                       ~17     !0, 'fruit'
         32        SEND_VAL                                                 ~17
         33        DO_ICALL                                         $18     
         34        ASSIGN                                                   !1, $18
   19    35        INIT_FCALL                                               'array_merge_recursive'
         36        SEND_VAR                                                 !1
         37        INIT_FCALL_BY_NAME                                       'get_pieces'
         38        SEND_VAL_EX                                              2
         39        DO_FCALL                                      0  $20     
         40        INIT_ARRAY                                       ~21     $20, 'pieces'
         41        SEND_VAL                                                 ~21
         42        DO_ICALL                                         $22     
         43        ASSIGN                                                   !1, $22
   41    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                                 
         47      > RETURN                                                   1

Function get_pieces:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
filename:       /in/RBZDo
function name:  get_pieces
number of ops:  19
compiled vars:  !0 = $id, !1 = $pieces
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        ASSIGN                                                   !1, <array>
   27     2        IS_EQUAL                                                 !0, 1
          3      > JMPNZ                                                    ~3, ->7
   32     4    >   IS_EQUAL                                                 !0, 2
          5      > JMPNZ                                                    ~3, ->12
          6    > > JMP                                                      ->17
   28     7    >   ASSIGN_DIM                                               !1
          8        OP_DATA                                                  <array>
   29     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  <array>
   30    11      > JMP                                                      ->17
   33    12    >   ASSIGN_DIM                                               !1
         13        OP_DATA                                                  <array>
   34    14        ASSIGN_DIM                                               !1
         15        OP_DATA                                                  <array>
   35    16      > JMP                                                      ->17
   38    17    > > RETURN                                                   !1
   39    18*     > RETURN                                                   null

End of function get_pieces

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.73 ms | 1444 KiB | 16 Q