public static function permute(Array $set) 
	{
		$perms = [];
		
		$j    = 0;
		$size = count($set) - 1;
		$perm = range(0, $size);
			
		do { 
			foreach ($perm as $i) { 
				$perms[$j][] = $set[$i]; 
			}
		} while ($perm = self::getNextPermutation($perm, $size) and ++$j);
		
		return $perms;
	}