#include
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR pCmdLine, int nCmdShow) {
MessageBox(NULL, GetCommandLine(),
TEXT(“勇者の攻撃!”), MB_ICONINFORMATION);
return 0;
}
#include
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR pCmdLine, int nCmdShow) {
MessageBox(NULL, GetCommandLine(),
TEXT(“勇者の攻撃!”), MB_ICONINFORMATION);
return 0;
}
#include
int WINAPI WinMain(
HINSTANCE hInstance ,
HINSTANCE hPrevInstance ,
PSTR lpCmdLine ,
int nCmdShow ) {
MessageBox(NULL , TEXT(“Kitty on your lap”) ,
TEXT(“メッセージボックス”) , MB_OK);
return 0;
}
http://wisdom.sakura.ne.jp/system/winapi/win32/win5.html
<?php
$moreScores = [
55,
72,
‘perfect’,
[90, 42, 88],
];
$scores = [
90,
40,
…$moreScores,
100,
];
// print_r($scores);
echo $scores[5][2] . PHP_EOL;
<?php
$scores = [
‘first’ => 90,
‘second’ => 40,
‘third’ => 100,
];
// foreach ($scores as $value) {
// foreach ($scores as $score) {
// echo $score . PHP_EOL;
// }
foreach ($scores as $key => $score) {
echo $key . ‘ – ‘ . $score . PHP_EOL;
}
<?php
$scores = [
‘first’ => 90,
‘second’ => 40,
‘third’ => 100,
];
// var_dump($scores);
// print_r($scores);
echo $scores[‘third’] . PHP_EOL;
<?php
// $score1 = 90;
// $socre2 = 40;
// $score3 = 100;
$scores = [
90,
40,
100,
];
$scores[1] = 60;
echo $scores[1] . PHP_EOL;
~ $ php main.php
Gold Medal
Fatal error: Uncaught TypeError: Return value of getAward() must be of the type string, null returned in /home/dotinstall/main.php:7
Stack trace:
#0 /home/dotinstall/main.php(11): getAward(40)
#1 {main}
thrown in /home/dotinstall/main.php on line 7
~ $ php main.php
Gold Medal
~ $ php main.php
Gold Medal
~ $
<?php
declare(strict_types=1);
function getAward(?int $score): ?string
{
return $score >= 100 ? ‘Gold Medal’ : null;
}
echo getAward(150) .PHP_EOL;
echo getAward(40) .PHP_EOL;