[Solved] Calculation of ever rising value [closed]


Your point structure does not match up with your sentence.

So I’ll answer:

To reach level 2 50 XP is needed. To reach level 3 a further 55 XP is
needed. To reach level 4 a further 60 XP is needed and so forth.

<?php
$get_level = function () {
    foreach (range(0, 300, 50) as $difficulty => $base) {
        yield [$base + ($difficulty * 5) => 'Level '.($base / 50)];
    }
};

foreach ($get_level() as $base => $level) {
    echo print_r($level, true);
}

Result:

Array
(
    [0] => Level 0
)
Array
(
    [55] => Level 1
)
Array
(
    [110] => Level 2
)
Array
(
    [165] => Level 3
)
Array
(
    [220] => Level 4
)
Array
(
    [275] => Level 5
)
Array
(
    [330] => Level 6
)

solved Calculation of ever rising value [closed]