The job to be done is show the price of postage per KG. So starting at 1KG, I want to increase by 0.50 for every KG.
I tried doing it like this which doesn't seem to work for me:
$shipping_second_class = array (
array ('weight' => range(1,5), 'cost' => range(1,3, 0.50))
);
foreach ($shipping_second_class as $shipping_second_class) {
echo('weight '.$shipping_second_class['weight'].' costs £'.$shipping_second_class['cost'].'<br/>');
}
That doesn't seem to work. What I'm trying to do in a way that's easier to maintain is something like this, but with less code:
$shipping_second_class = array (
array ('weight' => '1', 'cost' => '1'),
array ('weight' => '2', 'cost' => '1.5'),
array ('weight' => '3', 'cost' => '2'),
array ('weight' => '4', 'cost' => '2.5'),
array ('weight' => '5', 'cost' => '3'),
);
foreach ($shipping_second_class as $shipping_second_class) {
echo('weight '.$shipping_second_class['weight'].' costs £'.$shipping_second_class['cost'].'<br/>');
}