3v4l.org

run code in 300+ PHP versions simultaneously
<?php $root = array_map(function($v) { return 'cat'.$v; }, range(1,10)); //array( 1=>'cat1', 2=>'cat2', 3=>'cat3' ); $child_1 = array_map(function($v) { return 'sub_cat'.$v; },range(1,16)); //array( 1=>'sub_cat1', 2=>'sub_cat2', 3=>'sub_cat3' ); $child_2 = array_map(function($v) { return 'sub_sub_cat'.$v; },range(1.30)); //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) { $kdi = $kd; array_push($kdi, $ck); $vdi = $vd; array_push($vdi, $cv); if(!empty($source_arrays)) { $return += getAllCombinationsArray($source_arrays, $kdi, $vdi); } else { $return[implode('_', $kdi)] = implode(' -> ', $vdi); } } return $return; } print_r(getAllCombinationsArray(array($root, $child_1, $child_2)));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: range() expects at least 2 arguments, 1 given in /in/fMPqR:5 Stack trace: #0 /in/fMPqR(5): range(1.3) #1 {main} thrown in /in/fMPqR on line 5
Process exited with code 255.

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