Skip to content

Instantly share code, notes, and snippets.

@zonuexe
Last active May 19, 2017 01:27
Show Gist options
  • Save zonuexe/3c9960d1b42239e88602c9d56d4b1fdd to your computer and use it in GitHub Desktop.
Save zonuexe/3c9960d1b42239e88602c9d56d4b1fdd to your computer and use it in GitHub Desktop.
PHP 配列っぽいもの列伝
構文 意味
array 配列リテラル array(1, 2)
die PHPスクリプトの終了 foo() or dir(1);
echo 文字列を標準出力 echo $message, PHP_EOL;
empty 値/変数が「空」または「偽」かの検査 if (empty($v) || empty($a['i']))
eval 文字列をPHPスクリプトとして評価 eval($s)
exit PHPスクリプトの終了 exit(0);
include、include_once PHPスクリプトの読み込み include_once __DIR__ . '/Foo.php';
isset 値/変数が存在するかの検査 $v = isset($a['i']) ? $a['i'] : 's';
list 複数の値(配列)を変数に代入 list($a, $b, $c) = [1, 2, 3];
print 文字列を標準出力 ($c === 1) ? print $t : print $f;
require、require_once PHPスクリプトの読み込み require 'lib.php';
unset 変数/インデックスの破棄 unset($v);、unset($a['i']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment