Refactor foreach() loop.
All checks were successful
The build was successful.

In AerScript, the foreach() loop is syntatically more similiar to C#, than PHP. However the optional '$key => $value' construct is still available, because arrays in AerScript are still a hashmaps.
This commit is contained in:
2019-04-30 23:38:59 +02:00
parent 1156519af6
commit 4d8d92092e
6 changed files with 89 additions and 203 deletions

View File

@@ -10,7 +10,7 @@ class Program {
int $matches;
string $roman;
int $value;
foreach($lookup as $roman => $value) {
foreach($roman => $value in $lookup) {
$matches = (int) ($n / $value);
$result += str_repeat($roman, $matches);
$n = $n % $value;