3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ (object) [ 'C1' => 'C1V1', 'C2' => 'C2V1', 'C3' => 'C3V1', ], (object) [ 'C1' => 'C1V2', 'C2' => 'C2V2', 'C3' => 'C3V2', ] ]; $arr = json_decode(json_encode($arr), true); // format //[["C1","C2","C3],[C1V1,C2V1,C3V1],[C1V2,C2V2,C3V3]] $i=0; $newArr[0] = array_keys($arr[0]); foreach($arr as $record) { $i++; foreach($record as $col => $val) { $newArr[$i][] = $val; } } print_r($newArr);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => C1 [1] => C2 [2] => C3 ) [1] => Array ( [0] => C1V1 [1] => C2V1 [2] => C3V1 ) [2] => Array ( [0] => C1V2 [1] => C2V2 [2] => C3V2 ) )

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:
35.59 ms | 406 KiB | 5 Q