This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* はてなブログに投稿するクラス | |
* | |
* @package HatenaBlogPost | |
* @version 0.1.0 | |
* @see https://developer.hatena.ne.jp/ja/documents/blog/apis/atom/ | |
* @see https://developer.hatena.ne.jp/ja/documents/auth/apis/wsse | |
* @example | |
* require_once('HatenaBlogPost.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* パズルの盤面を生成するクラス | |
* | |
*/ | |
class PazzleBoard{ | |
//----------------------------------- | |
// プロパティ | |
//----------------------------------- | |
private $width; // 幅 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 重複を削除する | |
* | |
*/ | |
//------------------------------------ | |
// グローバル変数 | |
//------------------------------------ | |
// 好きなゲーム一覧 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* ユーザー属性を集計する | |
* | |
*/ | |
//---------------------------------------- | |
// ユーザー属性のデータ | |
//---------------------------------------- | |
$user = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 武器屋経営 | |
* - 在庫数と在庫金額を調べる | |
*/ | |
//------------------------------------ | |
// 在庫の一覧 | |
//------------------------------------ | |
$weapons = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//--------------------------------------------------- | |
// 定数 | |
//--------------------------------------------------- | |
// 配列のインデックスを定義 | |
define('MONSTER_ID', 0); // モンスターID | |
define('MONSTER_NAME', 1); // モンスター名 | |
define('MONSTER_LEVEL',2); // モンスターレベル | |
define('MONSTER_AREA', 3); // 出現エリア |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$apple = [ | |
'name' => 'りんご', | |
'price' => 150, | |
'stock' => true | |
]; | |
echo json_encode($apple); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tama = new Cat('たま', 'にゃー'); | |
$tama->mynameis(); // "私の名前はたまです。" | |
$tama->say('こんにちは'); // "こんにちはにゃー" | |
class Animal{ | |
protected $name; | |
function __construct($name){ | |
$this->name = $name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$shoppingCart = [1, 2, 2, 3]; | |
// 合計金額を計算する | |
$total = 0; | |
// ★この部分を回答する★ | |
// 合計金額を表示する | |
echo $total; // "800"と表示される | |
echo "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ジョーカーが何枚目に排出されるか数える | |
* | |
*/ | |
//---------------------------------------- | |
// ライブラリ | |
//---------------------------------------- | |
require_once('trump.class.php'); |
NewerOlder