We can now declare key and value variables inside a loop.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-05-01 11:51:08 +02:00
parent bbcd99789d
commit 186e5887f6
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 1 additions and 3 deletions

View File

@ -8,9 +8,7 @@ class Program {
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1}; 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1};
int $matches; int $matches;
string $roman; foreach(string $roman => int $value in $lookup) {
int $value;
foreach($roman => $value in $lookup) {
$matches = (int) ($n / $value); $matches = (int) ($n / $value);
$result += str_repeat($roman, $matches); $result += str_repeat($roman, $matches);
$n = $n % $value; $n = $n % $value;