LoginSignup
0
0

More than 5 years have passed since last update.

phpで問題を解いてみた【5】

Posted at

問題

あなたが投票するかもしれない党をおみくじ形式でだそう。

自分なりの回答

<?php
// Here your code !
$tou = array();
$tou[0] = "Ji党";
$tou[1] = "Ki党";
$tou[2] = "Ri党";
$tou[3] = "Ky党";
$tou[4] = "Ko党";
echo "あなたは".$tou[rand(0,count($tou) - 1)]."に投票するかもしれません。";
?>



まとめ

rand関数を使ってみたかっただけです。なかなか使う機会がないものでね。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0