3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $products = [1, 2, 3, 4, 5]; $vendors = ["Amazon", "Newegg", "Frys"]; $combinations = Array(); function pc_permute($items, $perms = array()) { if (empty($items)) { //echo join(' ', $perms) . "</br>"; //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 5.4.0 - 5.4.24
Parse error: syntax error, unexpected 'var_dump' (T_STRING) in /in/s0iMp on line 25
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/s0iMp on line 3
Process exited with code 255.