This commit is contained in:
parent
075d2f0963
commit
ab09ba6943
@ -3,9 +3,9 @@ class Program {
|
|||||||
private string num2Roman(int $num) {
|
private string num2Roman(int $num) {
|
||||||
int $n = intval($num);
|
int $n = intval($num);
|
||||||
string $result = '';
|
string $result = '';
|
||||||
int[] $lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
|
int[] $lookup = {'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
|
||||||
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
|
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
|
||||||
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
|
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1};
|
||||||
|
|
||||||
int $matches;
|
int $matches;
|
||||||
foreach($lookup as $roman => $value) {
|
foreach($lookup as $roman => $value) {
|
||||||
|
@ -2,7 +2,7 @@ class Unicode {
|
|||||||
|
|
||||||
public string unicon(string $str, bool $to_uni = true) {
|
public string unicon(string $str, bool $to_uni = true) {
|
||||||
string $cpp;
|
string $cpp;
|
||||||
string[] $cp = array('А' => 'А', 'а' => 'а',
|
string[] $cp = {'А' => 'А', 'а' => 'а',
|
||||||
"Б" => "Б", "б" => "б",
|
"Б" => "Б", "б" => "б",
|
||||||
"В" => "В", "в" => "в",
|
"В" => "В", "в" => "в",
|
||||||
"Г" => "Г", "г" => "г",
|
"Г" => "Г", "г" => "г",
|
||||||
@ -34,7 +34,7 @@ class Unicode {
|
|||||||
"Ь" => "Ь", "ь" => "ь",
|
"Ь" => "Ь", "ь" => "ь",
|
||||||
"Э" => "Э", "э" => "э",
|
"Э" => "Э", "э" => "э",
|
||||||
"Ю" => "Ю", "ю" => "ю",
|
"Ю" => "Ю", "ю" => "ю",
|
||||||
"Я" => "Я", "я" => "я");
|
"Я" => "Я", "я" => "я"};
|
||||||
if($to_uni) {
|
if($to_uni) {
|
||||||
$str = strtr($str, $cp);
|
$str = strtr($str, $cp);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user