3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "1", "0xd35a2d8c651f3eba4f0a044db961b5b0ccf68a2d", "309953166.54621424", "30.9953%", "2", "0xe17c20292b2f1b0ff887dc32a73c259fae25f03b", "200000001", "20.0000%", "3", "0x0000000000000000000000000000000000000000", "129336426", "12.9336%" ]; $innerKeys = ["address", "amount", "percent"]; $result = []; for ($i = 0; $i < count($array); $i++) { $rem = $i % 4; if ($rem === 0) $outerKey = $array[$i]; if ($rem > 0) $result[$outerKey][$innerKeys[$rem - 1]] = $array[$i]; } print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 5
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 5
Branch analysis from position: 23
Branch analysis from position: 5
Branch analysis from position: 19
Branch analysis from position: 11
filename:       /in/YktZ1
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $innerKeys, !2 = $result, !3 = $i, !4 = $rem, !5 = $outerKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   19     2        ASSIGN                                                   !2, <array>
   21     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->20
   22     5    >   MOD                                              ~10     !3, 4
          6        ASSIGN                                                   !4, ~10
   23     7        IS_IDENTICAL                                             !4, 0
          8      > JMPZ                                                     ~12, ->11
          9    >   FETCH_DIM_R                                      ~13     !0, !3
         10        ASSIGN                                                   !5, ~13
   24    11    >   IS_SMALLER                                               0, !4
         12      > JMPZ                                                     ~15, ->19
         13    >   SUB                                              ~17     !4, 1
         14        FETCH_DIM_R                                      ~18     !1, ~17
         15        FETCH_DIM_R                                      ~20     !0, !3
         16        FETCH_DIM_W                                      $16     !2, !5
         17        ASSIGN_DIM                                               $16, ~18
         18        OP_DATA                                                  ~20
   21    19    >   PRE_INC                                                  !3
         20    >   COUNT                                            ~22     !0
         21        IS_SMALLER                                               !3, ~22
         22      > JMPNZ                                                    ~23, ->5
   27    23    >   INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.09 ms | 999 KiB | 14 Q