Temporarily fix tests.
All checks were successful
The build was successful.

This commit is contained in:
2018-09-23 17:51:47 +02:00
parent dd774be005
commit 08296110fb
6 changed files with 17 additions and 14 deletions

View File

@@ -1,14 +1,15 @@
class Program {
private function num2Roman(int $num) {
$n = intval($num);
$result = '';
$lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
int $n = intval($num);
int $result = '';
mixed $lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
int $matches;
foreach($lookup as $roman => $value) {
$matches = intval($n / $value);
$matches = intval($n / $value);
$result += str_repeat($roman, $matches);
$n = $n % $value;
}