-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·63 lines (54 loc) · 1.34 KB
/
functions.php
File metadata and controls
executable file
·63 lines (54 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
function clean($string) {
// $string = mb_strtolower($string, "UTF-8");
$string = strtolower($string);
$string = str_replace(
array("À","Á","Â","Ä","È","É","Ê","Ë","Ì","Í","Î","Ï","Ò","Ó","Ô","Ö","Ù","Ú","Û","Ü","Œ","Æ"),
array("à","á","â","ä","è","é","ê","ë","ì","í","î","ï","ò","ó","ô","ö","ù","ú","û","ü","œ","æ"),
$string
);
$string = str_replace(array(
".",
",",
";",
":",
"?",
"!",
"…",
'"'
) , "", $string);
$string = str_replace("oe", "œ",$string);
$string = trim($string);
return $string;
}
function roman($num) {
$n = intval($num);
$res = '';
/*** roman_numerals array ***/
$roman_numerals = 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
);
foreach ($roman_numerals as $roman => $number) {
/*** divide to get matches ***/
$matches = intval($n / $number);
/*** assign the roman char * $matches ***/
$res.= str_repeat($roman, $matches);
/*** substract from the number ***/
$n = $n % $number;
}
/*** return the res ***/
return $res;
}
?>