3v4l.org

run code in 300+ PHP versions simultaneously
<?php $yaml = [ 'components' => [ [ 'cachet' => [ 'componentgroup' => 'FOO', 'componentname' => 'BAR' ] ], [ 'cachet' => [ 'componentgroup' => 'Key1', 'componentname' => 'Value1' ] ], [ 'cachet' => [ 'componentgroup' => 'Key2', 'componentname' => 'Value2' ] ], [ 'cachet' => [ 'componentgroup' => 'FOO', 'componentname' => 'BAZ' ] ], [ 'cachet' => [ 'componentgroup' => 'Key3', 'componentname' => 'Value3' ] ] ] ]; $yamlMap = []; foreach ($yaml['components'] as $yamlComponent) { $k = $yamlComponent['cachet']['componentgroup']; $v = $yamlComponent['cachet']['componentname']; $yamlMap[$k] = isset($yamlMap[$k]) ? array_merge((array)$yamlMap[$k], [$v]) : $v; } var_export($yamlMap);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 'FOO' => array ( 0 => 'BAR', 1 => 'BAZ', ), 'Key1' => 'Value1', 'Key2' => 'Value2', 'Key3' => 'Value3', )

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:
187.52 ms | 405 KiB | 5 Q