We are developing API for our ecommerce we are having different products such as Iphone / Ipad. Any product could come in many variations. For example, an iPhone comes in two colors (black and white) and three memory sizes (16GB, 32GB, 64GB). In contrast, an iPad has three variation types - two colors (black and white), three memory sizes (16GB, 32GB, 64GB) and two network options (Wifi only, 3G & Wifi). Consequently, the iPhone has 2x3=6 distinct SKUs and the iPad has 2x3x2=12 distinct SKUs.
For my input ,
We are using PHP , Our input is ,
$productName = 'iPhone 4s';
$variations = array(
'color' => array('black', 'white'),
'memory' => array('16GB', '32GB', '64GB')
);
For this I want output as ,
array(
0 => 'iPhone 4s - black, 16GB',
1 => 'iPhone 4s - black, 32GB',
2 => 'iPhone 4s - black, 64GB',
3 => 'iPhone 4s - white, 16GB',
4 => 'iPhone 4s - white, 32GB',
5 => 'iPhone 4s - white, 64GB',
);
The Product information is dynamic. How i can get output for exact input dynamically with PHP?