public static function combineGrid(array $grid) : array
    {
        $combinations = [[]];

        foreach ($grid as $i => $params) {
            $append = [];

            foreach ($combinations as $product) {
                foreach ($params as $param) {
                    $product[$i] = $param;
                    $append[] = $product;
                }
            }

            $combinations = $append;
        }

        return $combinations;
    }
public static function combineGrid(array $grid) : array
    {
        $combinations = [[]];

        foreach ($grid as $i => $params) {
            $append = [];

            foreach ($combinations as $product) {
                foreach ($params as $param) {
                    $product[$i] = $param;
                    $append[] = $product;
                }
            }

            $combinations = $append;
        }

        return $combinations;
    }
public static function combineGrid ( array $ grid ) : array { $ combinations = [ [ ] ] ; foreach ( $ grid as $ i => $ params ) { $ append = [ ] ; foreach ( $ combinations as $ product ) { foreach ( $ params as $ param ) { $ product [ $ i ] = $ param ; $ append [ ] = $ product ; } } $ combinations = $ append ; } return $ combinations ; }
Return an array of all possible combinations of parameters. i.e the
Cartesian product of the supplied parameter grid.

@param array $grid
@return array
Return an array of all possible combinations of parameters . i . e the Cartesian product of the supplied parameter grid .