3v4l.org

run code in 300+ PHP versions simultaneously
<?php $root = array( 1=>'cat1', 2=>'cat2', 3=>'cat3' ); $child_1 = array( 1=>'sub_cat1', 2=>'sub_cat2', 3=>'sub_cat3' ); $child_2 = array( 1=>'sub_sub_cat1', 2=>'sub_sub_cat2', 3=>'sub_sub_cat3' ); function getAllCombinationsArray($source_arrays = array(), $kd = array(), $vd = array()){ $return = array(); foreach(array_shift($source_arrays) as $ck => $cv) { if(!empty($source_arrays)) { $return += getAllCombinationsArray($source_arrays, $kd + (array)$ck, $vd + (array)$cv); } else { $return[implode('_', $kd)] = implode(' -> ', $vd); } } return $return; } print_r(getAllCombinationsArray(array($root, $child_1, $child_2)));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [1] => cat1 [2] => cat2 [3] => cat3 )

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:
45.78 ms | 401 KiB | 8 Q