Is there a way to automatically create numbers?
For example if I knew how many numbers I wanted I could do this
for($i = 0; $i == 10; $i++)
{
$i++;
}
but for the code I have at the moment I'm not sure how to do that.
Here is my code
$products = [
'prodcut_1' => [
'name' => 'Product 1',
],
'prodcut_2' => [
'name' => 'Product 2',
],
'prodcut_3' => [
'name' => 'Product 3',
]
];
$arr = [];
foreach($products as $key => $prodcut)
{
$arr[$key] = [
'number' => // the item number will go here
'name' => $item['name'],
'unit' => 'unit_'.$key,
'rate' => 'rate_'.$key
];
}