@anonymous/

TrustyNegativeJavabytecode

PHP (Legacy)

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.3489000080396256","path":"main.php","file":{"path":"main.php","content":{"asEncoding":{"base64":"PD9waHAKIAovLyBTdGFyaW5nIHN0cmFpZ2h0IHVwIGludG8gdGhlIHNreSAuLi4gb2ggbXkgbXkKZXJyb3JfcmVwb3J0aW5nKC0xKTsKbWJfaW50ZXJuYWxfZW5jb2RpbmcoJ3V0Zi04Jyk7CiAKIAovKiDQktC+0LfQstGA0LDRidCw0LXRgiDRgdC+0L7RgtCy0LXRgtGB0YLQstGD0Y7RidGD0Y4g0YfQuNGB0LvRgyDRhNC+0YDQvNGDINGB0LvQvtCy0LA6IDEg0YDRg9Cx0LvRjCwgMiDRgNGD0LHQu9GPLCA1INGA0YPQsdC70LXQuSAqLwpmdW5jdGlvbiBpbmNsaW5lV29yZCgkbnVtYmVyLCAkd29yZDEsICR3b3JkMiwgJHdvcmQ1KSB7CiAgICAkbGFzdFR3b0RpZ2l0cyA9ICRudW1iZXIgJSAxMDA7CiAgICBpZiAoJGxhc3RUd29EaWdpdHMgPiAxMCAmJiAkbGFzdFR3b0RpZ2l0cyA8IDIwKSB7CiAgICAgICAgcmV0dXJuICR3b3JkNTsKICAgIH0KICAgICRsYXN0RGlnaXQgPSAkbnVtYmVyICUgMTA7CiAgICBpZiAoJGxhc3REaWdpdCA9PSAwKSB7CiAgICAgICAgcmV0dXJuICR3b3JkNTsKICAgIH0gZWxzZWlmICgkbGFzdERpZ2l0ID09IDEpIHsKICAgICAgICByZXR1cm4gJHdvcmQxOwogICAgfSBlbHNlaWYgKCRsYXN0RGlnaXQgPiAxICYmICRsYXN0RGlnaXQgPCA1KSB7CiAgICAgICAgcmV0dXJuICR3b3JkMjsKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuICR3b3JkNTsKICAgIH0KfQogCi8qIAogICAg0J/RgNC10L7QsdGA0LDQt9GD0LXRg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AgIDIgICA9PiAgJ9C00LLQtScKICAgICk7CgogICAgJHRleHQgPSBbXTsKCiAgICAgICAgaWYgKCRudW1iZXIgPT0gMCkgewogICAgICAgICAgICByZXR1cm4gJHNwZWxsaW5nWyRudW1iZXJdOwogICAgICAgIH0KICAgICAgICBpZiAoKCRodW5kcmVkID0gZmxvb3IoJG51bWJlciAvIDEwMCkgKiAxMDApICE9IDApIHsKICAgICAgICAgICAgJHRleHRbXSA9ICRzcGVsbGluZ1skaHVuZHJlZF07CiAgICAgICAgfQogICAgICAgICR0ZW5zQW5kVW5pdHMgPSAkbnVtYmVyICUgMTAwOwogICAgICAgIGlmICgkdGVuc0FuZFVuaXRzID4gOSAmJiAkdGVuc0FuZFVuaXRzIDwgMjApIHsKICAgICAgICAgICAgJHRleHRbXSA9ICRzcGVsbGluZ1skdGVuc0FuZFVuaXRzXTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBpZiAoKCR0ZW4gPSBmbG9vcigkdGVuc0FuZFVuaXRzIC8gMTApICogMTApICE9IDApIHsKICAgICAgICAgICAgICAgICR0ZXh0W10gPSAkc3BlbGxpbmdbJHRlbl07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCgkdW5pdCA9ICR0ZW5zQW5kVW5pdHMgJSAxMCkgIT0gMCkgewogICAgICAgICAgICAgICAgaWYgKCgkaXNGZW1hbGUgPT0gMSkgJiYgKCR1bml0ID09IDEgfHwgJHVuaXQgPT0gMikpIHsKICAgICAgICAgICAgICAgICAgICAkdGV4dFtdID0gJGZlbWFsZVNwZWxsaW5nWyR1bml0XTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgJHRleHRbXSA9ICRzcGVsbGluZ1skdW5pdF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGltcGxvZGUoIiAiLCAkdGV4dCk7Cn0KIApmdW5jdGlvbiBudW1iZXJUb1RleHQoJG51bWJlcikgewoKICAgIGlmICgkbnVtYmVyID09IDApIHsKICAgICAgICByZXR1cm4gc21hbGxOdW1iZXJUb1RleHQoJG51bWJlciwgMCkgLiAiICIgLiBpbmNsaW5lV29yZCgkbnVtYmVyLCAn0YDRg9Cx0LvRjCcsJ9GA0YPQsdC70Y8nLCfRgNGD0LHQu9C10LknKSAuICJcbiI7CiAgICB9IGVsc2UgewogICAgICAgICR0ZXh0ID0gW107CiAgICAgICAgJG1pbGxpb24gPSBmbG9vcigkbnVtYmVyIC8gMTAwMDAwMCk7CiAgICAgICAgICAgIGlmICgkbWlsbGlvbiAhPSAwKSB7CiAgICAgICAgICAgICAgICAkdGV4dFtdID0gc21hbGxOdW1iZXJUb1RleHQoJG1pbGxpb24sIDApIC4gJyAnIC4gaW5jbGluZVdvcmQoJG1pbGxpb24sICfQvNC40LvQu9C40L7QvScsICfQvNC40LvQu9C40L7QvdCwJywgJ9C80LjQu9C70LjQvtC90L7QsicpOyAgICAgICAKICAgICAgICAgICAgfQogICAgICAgICR0aG91c2FuZCA9IGZsb29yKCgkbnVtYmVyICUgMTAwMDAwMCkgLyAxMDAwKTsKICAgICAgICAgICAgaWYgKCR0aG91c2FuZCAhPTApIHsKICAgICAgICAgICAgICAgICR0ZXh0W10gPSBzbWFsbE51bWJlclRvVGV4dCgkdGhvdXNhbmQsIDEpIC4gJyAnIC4gaW5jbGluZVdvcmQoJHRob3VzYW5kLCAn0YLRi9GB0Y/Rh9CwJywgJ9GC0YvRgdGP0YfQuCcsICfRgtGL0YHRj9GHJyk7CiAgICAgICAgICAgIH0KICAgICAgICAkaHVuZHJlZHNUZW5zVW5pdHMgPSAkbnVtYmVyICUgMTAwMDsKICAgICAgICAgICAgaWYgKCRodW5kcmVkc1RlbnNVbml0cyAhPSAwKSB7CiAgICAgICAgICAgICAgICAkdGV4dFtdID0gc21hbGxOdW1iZXJUb1RleHQoJGh1bmRyZWRzVGVuc1VuaXRzLCAwKTsgCiAgICAgICAgICAgIH0KICAgICAgICAkdGV4dFtdID0gaW5jbGluZVdvcmQoJG51bWJlciwgJ9GA0YPQsdC70YwnLCfRgNGD0LHQu9GPJywn0YDRg9Cx0LvQtdC5Jyk7CiAgICAgICAgcmV0dXJuIGltcGxvZGUoIiAiLCAkdGV4dCkgLiAiXG4iOwogICAgfQp9CiAKLyog0JLRi9C30L7QstC10Lwg0YTRg9C90LrRhtC40Y4g0L3QtdGB0LrQvtC70YzQutC+INGA0LDQtyAqLwoKJGFtb3VudDEgPSBtdF9yYW5kKDEsOTk5OTk5OTkpOwokdGV4dDEgPSBudW1iZXJUb1RleHQoJGFtb3VudDEpOwogCmVjaG8gItCd0LAg0LLQsNGI0LXQvCDRgdGH0LXRgtGDIHskdGV4dDF9XG4iOwogCiRhbW91bnQyID0gbXRfcmFuZCgxLDk5OTk5OTk5KTsKJHRleHQyID0gbnVtYmVyVG9UZXh0KCRhbW91bnQyKTsKIAplY2hvICLQndCwINCy0LDRiNC10Lwg0YHRh9C10YLRgyB7JHRleHQyfVxuIjsKIAokYW1vdW50MyA9IG10X3JhbmQoMSw5OTk5OTk5OSk7CiR0ZXh0MyA9IG51bWJlclRvVGV4dCgkYW1vdW50Myk7CiAKZWNobyAi0J3QsCDQstCw0YjQtdC8INGB0YfQtdGC0YMgeyR0ZXh0M31cbiI7CiAKJGFtb3VudDQgPSBtdF9yYW5kKDEsOTk5OTk5OTkpOwokdGV4dDQgPSBudW1iZXJUb1RleHQoJGFtb3VudDQpOwogCmVjaG8gItCd0LAg0LLQsNGI0LXQvCDRgdGH0LXRgtGDIHskdGV4dDR9XG4iOwo/Pg=="},"asBuffer":null},"loaded":true}}
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
 
// Staring straight up into the sky ... oh my my
error_reporting(-1);
mb_internal_encoding('utf-8');
 
 
/* Возвращает соответствующую числу форму слова: 1 рубль, 2 рубля, 5 рублей */
function inclineWord($number, $word1, $word2, $word5) {
    $lastTwoDigits = $number % 100;
    if ($lastTwoDigits > 10 && $lastTwoDigits < 20) {
        return $word5;
    }
    $lastDigit = $number % 10;
    if ($lastDigit == 0) {
        return $word5;
    } elseif ($lastDigit == 1) {
        return $word1;
    } elseif ($lastDigit > 1 && $lastDigit < 5) {
        return $word2;
    } else {
        return $word5;
    }
}
 
/* 
    Преобразует числа от 0 до 999 в текст. Параметр $isFemale равен нулю, 
    если мы считаем число для мужского рода (один рубль), 
    и 1 — для женского (одна тысяча) 
*/
function smallNumberToText($number, $isFemale) {
 
    $spelling = array(
        0   =>  'ноль',                                     10  =>  'десять',       100 =>  'сто',
        1   =>  'один',         11  =>  'одиннадцать',      20  =>  'двадцать',     200 =>  'двести',
        2   =>  'два',          12  =>  'двенадцать',       30  =>  'тридцать',     300 =>  'триста',
        3   =>  'три',          13  =>  'тринадцать',       40  =>  'сорок',        400 =>  'четыреста',
        4   =>  'четыре',       14  =>  'четырнадцать',     50  =>  'пятьдесят',    500 =>  'пятьсот',
        5   =>  'пять',         15  =>  'пятнадцать',       60  =>  'шестьдесят',   600 =>  'шестьсот',
        6   =>  'шесть',        16  =>  'шестнадцать',      70  =>  'семьдесят',    700 =>  'семьсот',    
        7   =>  'семь',         17  =>  'семнадцать',       80  =>  'восемьдесят',   800 =>  'восемьсот',
        8   =>  'восемь',       18  =>  'восемнадцать',     90  =>  'девяносто',     900 =>  'девятьсот',
        9   =>  'девять',       19  =>  'девятнадцать'    
    );
 
    $femaleSpelling = array(
        1   =>  'одна',        2   =>  'две'
    );

    $text = [];

        if ($number == 0) {
            return $spelling[$number];
        }
        if (($hundred = floor($number / 100) * 100) != 0) {
            $text[] = $spelling[$hundred];
        }
        $tensAndUnits = $number % 100;
        if ($tensAndUnits > 9 && $tensAndUnits < 20) {
            $text[] = $spelling[$tensAndUnits];
        } else {
            if (($ten = floor($tensAndUnits / 10) * 10) != 0) {
                $text[] = $spelling[$ten];
            }
            if (($unit = $tensAndUnits % 10) != 0) {
                if (($isFemale == 1) && ($unit == 1 || $unit == 2)) {
                    $text[] = $femaleSpelling[$unit];
                } else {
                    $text[] = $spelling[$unit];
                }
            }
        }
        return implode(" ", $text);
}
 
function numberToText($number) {

    if ($number == 0) {
        return smallNumberToText($number, 0) . " " . inclineWord($number, 'рубль','рубля','рублей') . "\n";
    } else {
        $text = [];
        $million = floor($number / 1000000);
            if ($million != 0) {
                $text[] = smallNumberToText($million, 0) . ' ' . inclineWord($million, 'миллион', 'миллиона', 'миллионов');       
            }
        $thousand = floor(($number % 1000000) / 1000);
            if ($thousand !=0) {
                $text[] = smallNumberToText($thousand, 1) . ' ' . inclineWord($thousand, 'тысяча', 'тысячи', 'тысяч');
            }
        $hundredsTensUnits = $number % 1000;
            if ($hundredsTensUnits != 0) {
                $text[] = smallNumberToText($hundredsTensUnits, 0); 
            }
        $text[] = inclineWord($number, 'рубль','рубля','рублей');
        return implode(" ", $text) . "\n";
    }
}
 
/* Вызовем функцию несколько раз */

$amount1 = mt_rand(1,99999999);
$text1 = numberToText($amount1);
 
echo "На вашем счету {$text1}\n";
 
$amount2 = mt_rand(1,99999999);
$text2 = numberToText($amount2);
 
echo "На вашем счету {$text2}\n";
 
$amount3 = mt_rand(1,99999999);
$text3 = numberToText($amount3);
 
echo "На вашем счету {$text3}\n";
 
$amount4 = mt_rand(1,99999999);
$text4 = numberToText($amount4);
 
echo "На вашем счету {$text4}\n";
?>
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7