3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attributes = [ [ 'title' => 'Size', 'Variation' => ['Small', 'Medium', 'Large'] ], [ 'title' => 'Length', 'Variation' => ['Short', 'Regular', 'Long'] ], [ 'title' => 'Color', 'Variation' => ['Black', 'White'] ] ]; function combinate($result, $variations) { $ret = []; foreach( $variations as $v ) { foreach( $result as $r ) { $ret[] = $v . ' ' . $r; } } return $ret; } $ret = $attributes[count($attributes) - 1]['Variation']; for( $i = count($attributes) - 2; $i >= 0; $i--) { $ret = combinate($ret, $attributes[$i]['Variation']); } print_r($ret);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Small Short Black [1] => Small Short White [2] => Small Regular Black [3] => Small Regular White [4] => Small Long Black [5] => Small Long White [6] => Medium Short Black [7] => Medium Short White [8] => Medium Regular Black [9] => Medium Regular White [10] => Medium Long Black [11] => Medium Long White [12] => Large Short Black [13] => Large Short White [14] => Large Regular Black [15] => Large Regular White [16] => Large Long Black [17] => Large Long White )

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:
27.15 ms | 407 KiB | 5 Q