- var_export: documentation ( source)
- range: documentation ( source)
<?php
$pricePerDay = 800;
$days = range(1,20);
$arr = array();
foreach ($days as $day) {
$price = ($day * $pricePerDay);
$arr[] = [$day => $price];
//echo sprintf('Dag: %s, Pris: %s ', $day, $price) . PHP_EOL;
}
echo var_export($arr);