<?php
$data = [
'Colour' => [
'Red' => 'Red',
'Blue' => 'Blue',
],
'Size' => [
'Small' => 'Small',
'Medium' => 'Medium',
'Large' => 'Large',
],
'Brand' => [
'Nike' => 'Nike',
'Adidas' => 'Adidas',
],
];
$combined = [];
foreach ($data['Colour'] as $colour) {
foreach ($data['Brand'] as $brand) {
foreach ($data['Size'] as $size) {
$combined[] = implode(' - ', [
$colour,
$size,
$brand
]);
}
}
}
var_dump($combined);
preferences:
25.45 ms | 405 KiB | 5 Q