3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = [1, 2, 3, 4, 5]; $vendors = ["Amazon", "Newegg", "Frys"]; $combinations = ['wtf']; function pc_permute($items, $perms = array()) { if (empty($items)) { //echo join(' ', $perms); //return $perms; array_push($combinations, $perms); } else { for ($i = count($items) - 1; $i >= 0; --$i) { $newitems = $items; $newperms = $perms; list($foo) = array_splice($newitems, $i, 1); array_unshift($newperms, $foo); pc_permute($newitems, $newperms); } } } pc_permute($products); var_dump($combinations);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /in/B7Ni4:12 Stack trace: #0 /in/B7Ni4(12): array_push(NULL, Array) #1 /in/B7Ni4(19): pc_permute(Array, Array) #2 /in/B7Ni4(19): pc_permute(Array, Array) #3 /in/B7Ni4(19): pc_permute(Array, Array) #4 /in/B7Ni4(19): pc_permute(Array, Array) #5 /in/B7Ni4(19): pc_permute(Array, Array) #6 /in/B7Ni4(24): pc_permute(Array) #7 {main} thrown in /in/B7Ni4 on line 12
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:
40.11 ms | 401 KiB | 8 Q