3v4l.org

run code in 300+ PHP versions simultaneously
<?php $one_array_key = ['A', 'A', 'A', 'B', 'B', 'B']; $second_array_values = ['arn1', 'arn2', 'arn3', 'arn4', 'arn5', 'arn6']; $result = []; foreach ($one_array_key as $index => $value) { $result[$value][] = $second_array_values[$index]; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'A' => array ( 0 => 'arn1', 1 => 'arn2', 2 => 'arn3', ), 'B' => array ( 0 => 'arn4', 1 => 'arn5', 2 => 'arn6', ), )

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.07 ms | 1399 KiB | 4 Q