Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

There should be a way to preserve keys with CartesianProduct #63

Open
ostrolucky opened this issue Mar 21, 2019 · 0 comments
Open

There should be a way to preserve keys with CartesianProduct #63

ostrolucky opened this issue Mar 21, 2019 · 0 comments

Comments

@ostrolucky
Copy link

ostrolucky commented Mar 21, 2019

This is a feature request.

Input:

$data = [
    'hair' => [
        'blond',
        'black'
    ],
    'eyes' => [
        'blue',
        'green',
    ]
];

Expected output:

Array
(
    [0] => Array
        (
            [hair] => blond
            [eyes] => blue
        )

    [1] => Array
        (
            [hair] => blond
            [eyes] => green
        )

    [2] => Array
        (
            [hair] => black
            [eyes] => blue
        )

    [3] => Array
        (
            [hair] => black
            [eyes] => green
        )
)

Use case:

combining all possible route parameter values for sitemap generation


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant