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 | |
$base = 5; // 底辺 | |
$height = 10; // 高さ | |
// 面積を求める | |
// ※ここを回答する※ | |
// 結果を表示 | |
echo $area; // 25と表示される |
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
<script> | |
async function getFruits(){ | |
try{ | |
const fruits = await fetch('http://localhost/fruits.json') | |
const json = await fruits.json() | |
for(let i=0; i<json.length; i++){ | |
const name = json[i].name | |
const price = json[i].price | |
const jp = json[i].jp |
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 | |
//------------------------------ | |
// グローバル変数 | |
//------------------------------ | |
// 押されたボタンの一覧 | |
// ↑11, ↗12, →13, ↘14, ↓15, ↙16, ←17, ↖18 | |
// パンチ:20, キック:30 | |
$KEY_BUFFER = [13, 13, 13, 20, 13, 15, 14, 20, 17, 15, 30]; | |
//------------------------------ |
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 | |
echo calcScore([1, 13]) . "\n"; // 21 = 11 + 10 | |
echo calcScore([9, 1, 1]) . "\n"; // 21 = 9 + 11 + 1 | |
echo calcScore([13, 2, 1]) . "\n"; // 13 = 10 + 2 + 1 | |
/** | |
* ブラックジャックのスコアを計算する | |
*/ | |
function calcScore($card){ |
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 | |
// クエリーを取得 | |
$maker_cd = $_POST['maker_cd']; // 半角英字 2byte | |
$maker_name = $_POST['maker_name']; // 文字列 2byte | |
// 準備 | |
$dsn = 'mysql:dbname=cardb;host=127.0.0.1'; // 接続先を定義 | |
$user = 'senpai'; // MySQLのユーザーID | |
$pw = 'indocurry'; // MySQLのパスワード |
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
CREATE TABLE Users( | |
id int AUTO_INCREMENT, | |
username varchar(128), | |
password varchar(40), | |
nickname varchar(128), | |
regist_at datetime, | |
status int DEFAULT 1, | |
PRIMARY KEY(id), | |
UNIQUE idx_uq_username (username) |
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
CREATE DATABASE car; | |
USE car; | |
CREATE TABLE Maker( | |
cd varchar(2), | |
name varchar(32), | |
country varchar(16), | |
PRIMARY KEY(cd) | |
); |
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('trumpUtil.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 | |
//----------------------------------- | |
// 定数 | |
//----------------------------------- | |
define('TETRIS_WIDTH', 6); // 横幅 | |
define('TETRIS_HEIGHT', 8); // 高さ | |
//----------------------------------- | |
// グローバル変数 | |
//----------------------------------- |
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 | |
// オセロ盤のデータを入れる配列 | |
$OTHELLO_BOARD = [ | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 1, 2, 0, 0, 0], | |
[0, 0, 0, 2, 1, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], |