3v4l.org

run code in 500+ PHP versions simultaneously
<?php $BrickTerritorys = [ 1 => (object)[ 'id' => 119, 'TerritoryID' => 'HYD-2-CMD', 'BrickCode' => 16, 'BrickName' => 'BUHURO', 'Weightage' => '40.00', 'BPCode' => 'bp00066', 'GroupCode' => 'CMD' ], 2 => (object)[ 'id' => 36330, 'TerritoryID' => 'HYD-1-CMD', 'BrickCode' => 16, 'BrickName' => 'BUHURO', 'Weightage' => '60.00', 'BPCode' => 'bp00066', 'GroupCode' => 'CMD' ] ]; $array = (array)$BrickTerritorys; // cast as array $tids = array_column($array, 'TerritoryID'); // isolate column data $was = array_column($array, 'Weightage'); // isolate column data $merged = array_merge($tids, $was); // add 2nd array data after 1st array data foreach ($merged as $i => $v) { echo str_repeat('-', $i) , $v; // increase hyphens on each iteration starting from 0 }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 32
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/YhD8A
function name:  (null)
number of ops:  34
compiled vars:  !0 = $BrickTerritorys, !1 = $array, !2 = $tids, !3 = $was, !4 = $merged, !5 = $v, !6 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   CAST                                              8  ~7      <array>
          1        INIT_ARRAY                                           ~8      ~7, 1
          2        CAST                                              8  ~9      <array>
          3        ADD_ARRAY_ELEMENT                                    ~8      ~9, 2
    2     4        ASSIGN                                                       !0, ~8
   23     5        CAST                                              7  ~11     !0
          6        ASSIGN                                                       !1, ~11
   24     7        INIT_FCALL                                                   'array_column'
          8        SEND_VAR                                                     !1
          9        SEND_VAL                                                     'TerritoryID'
         10        DO_ICALL                                             $13     
         11        ASSIGN                                                       !2, $13
   25    12        INIT_FCALL                                                   'array_column'
         13        SEND_VAR                                                     !1
         14        SEND_VAL                                                     'Weightage'
         15        DO_ICALL                                             $15     
         16        ASSIGN                                                       !3, $15
   26    17        INIT_FCALL                                                   'array_merge'
         18        SEND_VAR                                                     !2
         19        SEND_VAR                                                     !3
         20        DO_ICALL                                             $17     
         21        ASSIGN                                                       !4, $17
   27    22      > FE_RESET_R                                           $19     !4, ->32
         23    > > FE_FETCH_R                                           ~20     $19, !5, ->32
         24    >   ASSIGN                                                       !6, ~20
   28    25        INIT_FCALL                                                   'str_repeat'
         26        SEND_VAL                                                     '-'
         27        SEND_VAR                                                     !6
         28        DO_ICALL                                             $22     
         29        ECHO                                                         $22
         30        ECHO                                                         !5
   27    31      > JMP                                                          ->23
         32    >   FE_FREE                                                      $19
   29    33      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.01 ms | 2255 KiB | 16 Q