- floor: documentation ( source)
- implode: documentation ( source)
<?php
$input = 20;
$a = function ($n) {
return 10 * floor($n / 4);
};
$b = function ($n) {
return 2 ** ($n % 4);
};
$values = [];
for ($n = 0; $input >= $value = $a($n) + $b($n) ; ++$n) {
$values[] = $value;
}
echo implode(' ', $values);