3v4l.org

run code in 300+ PHP versions simultaneously
<?php $product = [ 'title' => 'Modest Swimsuit - Full body', 'description' => 'UV +50 Protection - Chlorine Resistant - Water Resistant - Quick Drying - Maximum Breathe Ability- Sea, Water Resistant', 'price' => 59.95, 'stock' => 20, ]; $attributes = [ ['name' => 'Brand', 'value' => 'Modestly Active Swimwear'], ['name' => 'Colour', 'value' => 'Black and Light Blue'], ['name' => 'size', 'value' => 'small'], ['name' => 'size', 'value' => 'medium'], ['name' => 'size', 'value' => 'large'], ]; $pivoted = []; foreach ($attributes as ['name' => $name, 'value' => $value]) { $name = strtolower($name); if (isset($pivoted[$name])) { $pivoted[$name] = (array) $pivoted[$name]; $pivoted[$name][] = $value; } else { $pivoted[$name] = $value; } } var_export($product + $pivoted);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/TSo8H
function name:  (null)
number of ops:  33
compiled vars:  !0 = $product, !1 = $attributes, !2 = $pivoted, !3 = $name, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   18     2        ASSIGN                                                   !2, <array>
   19     3      > FE_RESET_R                                       $8      !1, ->27
          4    > > FE_FETCH_R                                               $8, $9, ->27
          5    >   FETCH_LIST_R                                     $10     $9, 'name'
          6        ASSIGN                                                   !3, $10
          7        FETCH_LIST_R                                     $12     $9, 'value'
          8        ASSIGN                                                   !4, $12
          9        FREE                                                     $9
   20    10        INIT_FCALL                                               'strtolower'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $14     
         13        ASSIGN                                                   !3, $14
   21    14        ISSET_ISEMPTY_DIM_OBJ                         0          !2, !3
         15      > JMPZ                                                     ~16, ->24
   22    16    >   FETCH_DIM_R                                      ~18     !2, !3
         17        CAST                                          7  ~19     ~18
         18        ASSIGN_DIM                                               !2, !3
         19        OP_DATA                                                  ~19
   23    20        FETCH_DIM_W                                      $20     !2, !3
         21        ASSIGN_DIM                                               $20
         22        OP_DATA                                                  !4
   21    23      > JMP                                                      ->26
   25    24    >   ASSIGN_DIM                                               !2, !3
         25        OP_DATA                                                  !4
   19    26    > > JMP                                                      ->4
         27    >   FE_FREE                                                  $8
   29    28        INIT_FCALL                                               'var_export'
         29        ADD                                              ~23     !0, !2
         30        SEND_VAL                                                 ~23
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.03 ms | 1012 KiB | 15 Q