// おみくじを作る
// 比較演算子 == > < >= <= !=
// 大吉・中吉・小吉・凶・大凶
<?php
$omikuji = rand(1,10);
echo $omikuji."\n";
if ($omikuji == 1) {
echo "大吉";
} elseif ($omikuji == 2) {
echo "中吉";
} elseif ($omikuji <= 4) {
echo "小吉"; // 3,4
} elseif ($omikuji <= 7) {
echo "凶"; // 5,6,7
} else {
echo "大凶"; // 8,9,10
}
?>
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme