-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
46 lines (42 loc) · 1.18 KB
/
functions.php
File metadata and controls
46 lines (42 loc) · 1.18 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
<?php
function getRarityLevelId($rarity)
{
switch ($rarity) {
case 'پرکاربرد': //ک ك
case 'پركاربرد':
return 0;
case 'معمولی': // ی ي
case 'معمولي':
return 1;
case 'بسیار نادر': // ی ي
case 'بسيار نادر':
return 2;
default:
die("Error: Unknown rarity: $rarity");
}
}
function process($index, $line, $arr, $ceateJson)
{
list($name, $pesarane, $dokhtarane, $rarity) = $line;
if ($ceateJson && $rarity == 0) {
if ($pesarane == 1 && $dokhtarane == 1)
$arr['both'][] = $name;
else if ($pesarane == 1)
$arr['male'][] = $name;
else if ($dokhtarane == 1)
$arr['female'][] = $name;
}
$pesarane = $pesarane == 1 ? 'بله' : 'نه';
$dokhtarane = $dokhtarane == 1 ? 'بله' : 'نه';
echo "$index. نام: $name, پسرانه: $pesarane, دخترانه: $dokhtarane, میزان استفاده: $rarity\n";
return $arr;
}
function flush_buffers()
{
if (ob_get_length()) {
ob_flush();
flush();
ob_end_flush();
}
ob_start();
}