3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'product_template_id' => [ '0' => '1', '1' => '2' ], 'amount' => [ '0' => '50', '1' => '100' ] ]; $arr = []; for ($x = 0; $x <= count($array['amount']); $x ++) { $arr[$x] = [ 'product_template_id' => $array['product_template_id'][$x], 'amount' => $array['amount'][$x], ]; } var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 4
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 4
Branch analysis from position: 17
Branch analysis from position: 4
filename:       /in/cSs08
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $arr, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   16     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->13
   18     4    >   FETCH_DIM_R                                      ~7      !0, 'product_template_id'
          5        FETCH_DIM_R                                      ~8      ~7, !2
          6        INIT_ARRAY                                       ~9      ~8, 'product_template_id'
   19     7        FETCH_DIM_R                                      ~10     !0, 'amount'
          8        FETCH_DIM_R                                      ~11     ~10, !2
          9        ADD_ARRAY_ELEMENT                                ~9      ~11, 'amount'
   17    10        ASSIGN_DIM                                               !1, !2
   19    11        OP_DATA                                                  ~9
   16    12        PRE_INC                                                  !2
         13    >   FETCH_DIM_R                                      ~13     !0, 'amount'
         14        COUNT                                            ~14     ~13
         15        IS_SMALLER_OR_EQUAL                                      !2, ~14
         16      > JMPNZ                                                    ~15, ->4
   23    17    >   INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.77 ms | 1395 KiB | 15 Q