3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( "service" => "coding", "data" => array( "ITEM" => array( array( "CODE" => "9999", //STANDARD "QUANTITY" => 1 ), ) ) ); $array2 = array( array( "a" => "1", "b" => "1", "c" => "1", "d" => "1", ), array( "cancel" => "1", "a" => "1", "b" => "", "c" => "", "d" => "1", ), array( "cancel" => "1", "a" => "", "b" => "1", "c" => "1", "d" => "", ), ); foreach ($array2 as $i => ['a' => $a, 'c' => $c]) { $temp = $array1; if($a == 1) { $temp['data']['ITEM'][] = [ 'SOMETHING' => 'this_is_a', 'ELSE' => '1' ]; } if ($c == 1) { $temp['data']['ITEM'][] = [ 'SOMETHING' => 'this_is_c', 'ELSE' => '1' ]; } echo "Loop #$i result:\n"; var_export($temp); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 32
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 32
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
Branch analysis from position: 17
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/4QNcv
function name:  (null)
number of ops:  34
compiled vars:  !0 = $array1, !1 = $array2, !2 = $a, !3 = $c, !4 = $i, !5 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   38     2      > FE_RESET_R                                       $8      !1, ->32
          3    > > FE_FETCH_R                                       ~14     $8, $9, ->32
          4    >   FETCH_LIST_R                                     $10     $9, 'a'
          5        ASSIGN                                                   !2, $10
          6        FETCH_LIST_R                                     $12     $9, 'c'
          7        ASSIGN                                                   !3, $12
          8        FREE                                                     $9
          9        ASSIGN                                                   !4, ~14
   39    10        ASSIGN                                                   !5, !0
   40    11        IS_EQUAL                                                 !2, 1
         12      > JMPZ                                                     ~17, ->17
   41    13    >   FETCH_DIM_W                                      $18     !5, 'data'
         14        FETCH_DIM_W                                      $19     $18, 'ITEM'
         15        ASSIGN_DIM                                               $19
   42    16        OP_DATA                                                  <array>
   46    17    >   IS_EQUAL                                                 !3, 1
         18      > JMPZ                                                     ~21, ->23
   47    19    >   FETCH_DIM_W                                      $22     !5, 'data'
         20        FETCH_DIM_W                                      $23     $22, 'ITEM'
         21        ASSIGN_DIM                                               $23
   48    22        OP_DATA                                                  <array>
   53    23    >   ROPE_INIT                                     3  ~26     'Loop+%23'
         24        ROPE_ADD                                      1  ~26     ~26, !4
         25        ROPE_END                                      2  ~25     ~26, '+result%3A%0A'
         26        ECHO                                                     ~25
   54    27        INIT_FCALL                                               'var_export'
         28        SEND_VAR                                                 !5
         29        DO_ICALL                                                 
   55    30        ECHO                                                     '%0A'
   38    31      > JMP                                                      ->3
         32    >   FE_FREE                                                  $8
   56    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.97 ms | 1407 KiB | 15 Q