Files
php-question/Question10-class/Ex02.php
2026-10-15 15:05:39 +09:00

26 lines
1008 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
/**
* [Ex02 オブジェクト指向 クラスのプロパティ操作]
*
* TODO:
* 1. 既に作成した User クラス(User.php)を利用します。
* 2. require_onceを使い、User.php を読み込んでください。
* 3. 変数 $us を宣言し、User クラスのインスタンスを生成して代入してください。
* 4. $us の user_id プロパティに 101 を代入してください。
* 5. $us の user_name プロパティに "リゾーム太郎" を代入してください。
* 6. $us の mail プロパティに "rhizome@hoge.com" を代入してください。
* 7. $us の password プロパティに "1qazxcv" を代入してください。
* 8. 最後に、$us の各プロパティ (user_id, user_name, mail, password) の値を出力してください。
*
*/
require_once __DIR__. '/User.php';
$us = new User ();
$us ->user_id = 101;
$us ->user_name = 'リゾーム太郎';
$us ->mail = 'rhizome@hoge.com';
$us ->password = "1qazxcv";
$us ->say();