3v4l.org

run code in 300+ PHP versions simultaneously
<?php function combinations(int $n, int $k):array { function combine(int $n, int $k, int $start = 0, array &$result = [], array &$all = []) { if ($k == 0) { $all[] = $result; return; } for ($i = $start; $i <= $n - $k; $i++) { $result[$k] = $i; combine($n, $k - 1, $i + 1, $result, $all); } } $res = []; $all = []; combine($n, $k, 0, $res, $all); return $all; } function may_add_combination_to_set(array $combination, array $sets) { foreach ($sets as $combinationInSet) { if (count(array_intersect($combinationInSet, $combination)) !== 1) { return false; } } return true; } $combinations = combinations(31, 6); $sets = []; foreach ($combinations as $combination) { if (may_add_combination_to_set($combination, $sets)) { $sets[] = $combination; } } count($sets);
Output for git.master, rfc.property-hooks
Fatal error: Out of memory (allocated 35655680 bytes) (tried to allocate 20480 bytes) in /in/vq7d6 on line 14 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for git.master_jit
Fatal error: Out of memory (allocated 18874368 bytes) (tried to allocate 20480 bytes) in /in/vq7d6 on line 14 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
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:
73.91 ms | 401 KiB | 8 Q