3v4l.org

run code in 300+ PHP versions simultaneously
<?php $resultset = [ ['id' => 1, 'type' => 'F-A', 'name' => 'jon', 'age' => 24], ['id' => 2, 'type' => 'F-A', 'name' => 'roy', 'age' => 25], ['id' => 3, 'type' => 'F-E', 'name' => 'robert', 'age' => 26], ['id' => 4, 'type' => 'F-E', 'name' => 'sina', 'age' => 25] ]; foreach ($resultset as $row) { $output['type'][$row['type']][] = ['name' => $row['name'], 'age' => $row['age'], 'id' => $row['id']]; } echo json_encode($output, JSON_PRETTY_PRINT);
Output for git.master_jit, git.master, rfc.property-hooks
{ "type": { "F-A": [ { "name": "jon", "age": 24, "id": 1 }, { "name": "roy", "age": 25, "id": 2 } ], "F-E": [ { "name": "robert", "age": 26, "id": 3 }, { "name": "sina", "age": 25, "id": 4 } ] } }

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.14 ms | 402 KiB | 8 Q