I need to translate the iteration number to a range from 1 to 7.
$y = keepInRange(1, 7, $i)
The expected result of input → output, as follows
- 1 → 1
- ...
- 7 → 7
- 8 → 1
- 9 → 2
- ...
- 14 → 7
- 15 → 1
I have already tried the following without success:
min(7, max(1, $numberToStr[$i])) (all output 1)
$y = $i % 7 (all outputs 0, Edit: this was a mistake by me, its the solution when +1 is added.)
source
share