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 }
Output for rfc.property-hooks, git.master, git.master_jit
HYD-2-CMD-HYD-1-CMD--40.00---60.00

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.54 ms | 1581 KiB | 4 Q