Files
php-question/Question10-class/Ex01.php
2026-10-15 15:01:51 +09:00

33 lines
984 B
PHP
Raw Permalink 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
/**
* [Ex01 オブジェクト指向クラスの問題]
*
* TODO:
* 1. 新しく「User.php」というファイルを作成し、以下の仕様に基づいてUserクラスを定義してください。
* - クラス名: User
* - プロパティ:
* user_id : ユーザID(整数)
* user_name : ユーザ名(文字列)
* mail : メールアドレス(文字列)
* password : パスワード(文字列)
* - メソッド: なし
*
* 2. 本ファイル内で、require_onceを使ってUser.phpを読み込んでください。
*
* 3. 変数 $us を宣言し、Userクラスのインスタンスを作成して代入してください。
*
* 4. 最後に、$us の各プロパティの値を出力してください。
*
*/
require_once __DIR__. '/User.php';
$us = new User ();
$us ->user_id = 789;
$us ->user_name = 'Taka';
$us ->mail = 'Taka@mail.co.jp';
$us ->password = 'tsuki';
$us ->say();