3v4l.org

run code in 300+ PHP versions simultaneously
<?php function combs($arr) { $combs = array_fill(0, count($arr)+1, array()); $cntArr = count($arr); for ($i = 1; $i < $cntArr; ++$i) { for ($j = $cntArr-$i; $j > 0; --$j) { $combs[$j][] = implode(', ', array_slice($arr, $i, $j)); } } return $combs; } $arr = array('a', 'b', 'c', 'd', 'e', 'f'); print_r(combs($arr));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( ) [1] => Array ( [0] => b [1] => c [2] => d [3] => e [4] => f ) [2] => Array ( [0] => b, c [1] => c, d [2] => d, e [3] => e, f ) [3] => Array ( [0] => b, c, d [1] => c, d, e [2] => d, e, f ) [4] => Array ( [0] => b, c, d, e [1] => c, d, e, f ) [5] => Array ( [0] => b, c, d, e, f ) [6] => Array ( ) )

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:
80.9 ms | 402 KiB | 8 Q