-
-
Save golubev-alex/34a4ba468ba5a162340d58e06cf8e201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// дебажим через логи в файл | |
$file = $_SERVER["DOCUMENT_ROOT"] .'/log.txt'; | |
file_put_contents($file, $url . PHP_EOL, FILE_APPEND); | |
file_put_contents($file, $result . PHP_EOL, FILE_APPEND); | |
// склонение числительных | |
function num_word($value, $words, $show = true) | |
{ | |
$num = $value % 100; | |
if ($num > 19) { | |
$num = $num % 10; | |
} | |
$out = ($show) ? $value . ' ' : ''; | |
switch ($num) { | |
case 1: $out .= $words[0]; break; | |
case 2: | |
case 3: | |
case 4: $out .= $words[1]; break; | |
default: $out .= $words[2]; break; | |
} | |
return $out; | |
} | |
num_word($views, array('отзыв', 'отзыва', 'отзывов')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment