Here is my simple code:
<?php
$components=array(
1 => 'Carrot', 'Apple', 'Orange',
2 => 'Boiled Egg', 'Omelet',
3 => 'Ice Cream', 'Pancake', 'Watermelon'
);
echo'<pre>';
var_dump($components);
echo'</pre>';
output :
array(6) {
[1]=>
string(6) "Carrot"
[2]=>
string(10) "Boiled Egg"
[3]=>
string(9) "Ice Cream"
[4]=>
string(6) "Omelet"
[5]=>
string(7) "Pancake"
[6]=>
string(10) "Watermelon"
}
'Apple'
& 'Orange'
?Make an array like this,
$components=array(
1 => ['Carrot', 'Apple', 'Orange'],
2 => ['Boiled Egg', 'Omelet'],
3 => ['Ice Cream', 'Pancake', 'Watermelon']
);
And now check your array.