3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 'parent_id' => array ( 9 => array ( 0 => 11, 1 => 12 ), 10 => array ( 0 => 13, 1 => 14 ), 20 => array ( 0 => 21, 1 => 22 ), 21 => array ( 0 => 23 ) ) ); // re-index to 0 $array = array_values($array['parent_id']); // output array $pairs = array(); for ($i = 0; $i < count($array) - 1; $i += 2) { for ($j = 0; $j < min(count($array[$i]), count($array[$i+1])); $j++) { $pairs[] = array($array[$i][$j], $array[$i+1][$j]); } } print_r($pairs);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => 11 [1] => 13 ) [1] => Array ( [0] => 12 [1] => 14 ) [2] => Array ( [0] => 21 [1] => 23 ) )

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