К сожалению, в комбинаторике слабоват и нуждаюсь в помощи.
Я делаю sitemap карту сайта, для этого нужно вычислить все возможные комбинации массива из 3 элементов (в будущем может быть больше):
$params = [
'renovation' => ['none', 'finish'], // отделка квартиры
'roomCount' => [1, 2, 3, 4, 5], // кол-во комнат
'type' => ['apartment', 'flat'], // тип недвижимости
];
Значение каждого элемента нужно скомбинировать с другими ключами, вот что я хочу получить в результате:
$result = [
['renovation' => 'none'],
['renovation' => 'finish'],
['roomCount' => 1],
['roomCount' => 2],
['roomCount' => 3],
['roomCount' => 4],
['roomCount' => 5],
['type' => 'apartment'],
['type' => 'flat'],
['renovation' => 'none', 'roomCount' => 1],
['renovation' => 'none', 'roomCount' => 2],
['renovation' => 'none', 'roomCount' => 3],
['renovation' => 'none', 'roomCount' => 4],
['renovation' => 'none', 'roomCount' => 5],
['renovation' => 'finish', 'roomCount' => 1],
['renovation' => 'finish', 'roomCount' => 2],
['renovation' => 'finish', 'roomCount' => 3],
['renovation' => 'finish', 'roomCount' => 4],
['renovation' => 'finish', 'roomCount' => 5],
['type' => 'flat', 'roomCount' => 1],
['type' => 'flat', 'roomCount' => 2],
['type' => 'flat', 'roomCount' => 3],
['type' => 'flat', 'roomCount' => 4],
['type' => 'flat', 'roomCount' => 5],
['type' => 'apartment', 'roomCount' => 1],
['type' => 'apartment', 'roomCount' => 2],
['type' => 'apartment', 'roomCount' => 3],
['type' => 'apartment', 'roomCount' => 4],
['type' => 'apartment', 'roomCount' => 5],
['type' => 'flat', 'renovation' => 'none'],
['type' => 'flat', 'renovation' => 'finish'],
['type' => 'apartment', 'renovation' => 'none'],
['type' => 'apartment', 'renovation' => 'finish'],
['renovation' => 'none', 'roomCount' => 1, 'type' => 'apartment'],
['renovation' => 'none', 'roomCount' => 2, 'type' => 'apartment'],
['renovation' => 'none', 'roomCount' => 3, 'type' => 'apartment'],
['renovation' => 'none', 'roomCount' => 4, 'type' => 'apartment'],
['renovation' => 'none', 'roomCount' => 5, 'type' => 'apartment'],
['renovation' => 'finish', 'roomCount' => 1, 'type' => 'apartment'],
['renovation' => 'finish', 'roomCount' => 2, 'type' => 'apartment'],
['renovation' => 'finish', 'roomCount' => 3, 'type' => 'apartment'],
['renovation' => 'finish', 'roomCount' => 4, 'type' => 'apartment'],
['renovation' => 'finish', 'roomCount' => 5, 'type' => 'apartment'],
['renovation' => 'none', 'roomCount' => 1, 'type' => 'flat'],
['renovation' => 'none', 'roomCount' => 2, 'type' => 'flat'],
['renovation' => 'none', 'roomCount' => 3, 'type' => 'flat'],
['renovation' => 'none', 'roomCount' => 4, 'type' => 'flat'],
['renovation' => 'none', 'roomCount' => 5, 'type' => 'flat'],
['renovation' => 'finish', 'roomCount' => 1, 'type' => 'flat'],
['renovation' => 'finish', 'roomCount' => 2, 'type' => 'flat'],
['renovation' => 'finish', 'roomCount' => 3, 'type' => 'flat'],
['renovation' => 'finish', 'roomCount' => 4, 'type' => 'flat'],
['renovation' => 'finish', 'roomCount' => 5, 'type' => 'flat'],
];