Files
php-question/Question03-if/Ex07.php
2026-10-06 12:10:09 +09:00

20 lines
759 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// TODO: 前画面で入力した「数値」を受け取ったうえで変数inputに代入してください
// numに、input(文字列)を数値変換した値を代入します
// ※ 入力された値が、数字ではなかった場合はプログラムがエラーになります
$num = intval($input); // intval(文字列)で数値変換している
/* TODO:
* 以下の仕様に沿ってプログラムを完成させてください
*
* ●1~5の数字を入力すると、入力した数字を表示
* ●1~5以外の数値を入力した場合は、「入力したのは,1~5以外です」を表示
*
* ※ プログラムは何行書いても良いです
* ※ 必ず論理演算子を使用してください
*/