3v4l.org

run code in 300+ PHP versions simultaneously
<?php $packageColumns = array( 'SequenceNumber' => 1, 'GroupPackageCount' => 1, 'Weight' => array( 'Value' => array('pkg_weight' => 2), 'Units' => 'LB' ), 'Dimensions' => array( 'Length' => array('pkg_length' => 6), 'Width' => array('pkg_width' => 5), 'Height' => array('pkg_height' => 3), 'Units' => 'IN' ) ); $package = array( 'pkg_weight' => 96, 'pkg_height' => 0, 'pkg_width' => 0, 'pkg_length' => 0 ); $newPackage = array(); foreach($packageColumns as $col => $def) { if(is_array($def)) { $newPackage[$col] = array(); foreach($def as $k => $default) { if(is_array($default)) { $key = key($default); $defaultValue = $default[$key]; } else { $key = $k; $defaultValue = $default; } if(isset($package[$key])) { $newPackage[$col][$k] = $package[$key]; } else if(isset($newPackage[$col][$k])) { continue; } else { $newPackage[$col][$k] = $defaultValue; } } } else { if(isset($package[$col])) { $newPackage[$col] = $package[$col]; } else if(isset($newPackage[$col])) { continue; } else { $newPackage[$col] = $def; } } } echo '<pre>'; print_r($newPackage); echo '</pre>';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 55
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 55
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 42
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 40
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 40
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
Branch analysis from position: 31
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 40
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 52
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
filename:       /in/icSPH
function name:  (null)
number of ops:  62
compiled vars:  !0 = $packageColumns, !1 = $package, !2 = $newPackage, !3 = $def, !4 = $col, !5 = $default, !6 = $k, !7 = $key, !8 = $defaultValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   23     2        ASSIGN                                                   !2, <array>
   24     3      > FE_RESET_R                                       $12     !0, ->55
          4    > > FE_FETCH_R                                       ~13     $12, !3, ->55
          5    >   ASSIGN                                                   !4, ~13
   25     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~15, ->42
   26     8    >   ASSIGN_DIM                                               !2, !4
          9        OP_DATA                                                  <array>
   27    10      > FE_RESET_R                                       $17     !3, ->40
         11    > > FE_FETCH_R                                       ~18     $17, !5, ->40
         12    >   ASSIGN                                                   !6, ~18
   28    13        TYPE_CHECK                                  128          !5
         14      > JMPZ                                                     ~20, ->22
   29    15    >   INIT_FCALL                                               'key'
         16        SEND_VAR                                                 !5
         17        DO_ICALL                                         $21     
         18        ASSIGN                                                   !7, $21
   30    19        FETCH_DIM_R                                      ~23     !5, !7
         20        ASSIGN                                                   !8, ~23
         21      > JMP                                                      ->24
   32    22    >   ASSIGN                                                   !7, !6
   33    23        ASSIGN                                                   !8, !5
   35    24    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, !7
         25      > JMPZ                                                     ~27, ->31
   36    26    >   FETCH_DIM_R                                      ~30     !1, !7
         27        FETCH_DIM_W                                      $28     !2, !4
         28        ASSIGN_DIM                                               $28, !6
         29        OP_DATA                                                  ~30
         30      > JMP                                                      ->39
   37    31    >   FETCH_DIM_IS                                     ~31     !2, !4
         32        ISSET_ISEMPTY_DIM_OBJ                         0          ~31, !6
         33      > JMPZ                                                     ~32, ->36
   38    34    > > JMP                                                      ->11
         35*       JMP                                                      ->39
   40    36    >   FETCH_DIM_W                                      $33     !2, !4
         37        ASSIGN_DIM                                               $33, !6
         38        OP_DATA                                                  !8
   27    39    > > JMP                                                      ->11
         40    >   FE_FREE                                                  $17
         41      > JMP                                                      ->54
   44    42    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, !4
         43      > JMPZ                                                     ~35, ->48
   45    44    >   FETCH_DIM_R                                      ~37     !1, !4
         45        ASSIGN_DIM                                               !2, !4
         46        OP_DATA                                                  ~37
         47      > JMP                                                      ->54
   46    48    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, !4
         49      > JMPZ                                                     ~38, ->52
   47    50    > > JMP                                                      ->4
         51*       JMP                                                      ->54
   49    52    >   ASSIGN_DIM                                               !2, !4
         53        OP_DATA                                                  !3
   24    54    > > JMP                                                      ->4
         55    >   FE_FREE                                                  $12
   53    56        ECHO                                                     '%3Cpre%3E'
   54    57        INIT_FCALL                                               'print_r'
         58        SEND_VAR                                                 !2
         59        DO_ICALL                                                 
   55    60        ECHO                                                     '%3C%2Fpre%3E'
         61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.25 ms | 1400 KiB | 17 Q