-
-
Save snnwolf/329e5155f0a3ff90c6fd 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
<?php | |
/** | |
* Функция для выдачи призов. | |
* В зависимости от набранных баллов. | |
* @param int $point сколько баллов уже набрал | |
* @return string какой приз положен, none = ничего | |
*/ | |
function checkPoints($point) | |
{ | |
if ($point >= 170) { | |
return '30R'; | |
} elseif ($point >= 350) { | |
return '60R'; | |
} elseif ($point >= 530) { | |
return '100R'; | |
} | |
return 'none'; | |
} | |
foreach (array(100, 172, 358, 534) as $point) { | |
echo "check: ", $point, " => "; | |
echo checkPoints($point, 1), "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment