Created
April 14, 2011 13:20
-
-
Save koshiaaaaan/919460 to your computer and use it in GitHub Desktop.
予約語一覧を出力します。
僕の環境である事と、分類分けが若干おかしいところがあるかも点、ご注意下さい。
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 | |
$classes = get_declared_classes(); | |
$interfaces = get_declared_interfaces(); | |
$contents = get_defined_constants(); | |
$functions = get_defined_functions(); | |
$separator = ' '; | |
// クラス | |
echo '[クラス]' . PHP_EOL . join($separator, $classes) . PHP_EOL; | |
// インターフェース | |
echo '[インターフェース]' . PHP_EOL . join($separator, $interfaces) . PHP_EOL; | |
// クラスキーワード | |
echo '[クラスキーワード]' . PHP_EOL . join($separator, array('self', 'static', 'parent')) . PHP_EOL; | |
// 定数 | |
echo '[定数]' . PHP_EOL . join($separator, array_keys($contents)) . PHP_EOL; | |
// マジック定数 | |
echo '[マジック定数]' . PHP_EOL . join($separator, array('__CLASS__', '__DIR__', '__FILE__', '__LINE__', '__FUNCTION__', '__METHOD__', '__NAMESPACE__')) . PHP_EOL; | |
// 定義済み変数 | |
echo '[定義済み変数(グローバル)]' . PHP_EOL . join($separator, array('GLOBALS', '_SERVER', '_GET', '_POST', '_COOKIE', '_FILES', '_ENV', '_REQUEST', '_SESSION')) . PHP_EOL; | |
// 関数 | |
echo '[関数]' . PHP_EOL . join($separator, $functions['internal']) . PHP_EOL; | |
// 言語構造 | |
echo '[言語構造]' . PHP_EOL . join($separator, array('die', 'echo', 'empty', 'exit', 'eval', 'include', 'include_once', 'isset', 'list', 'require', 'require_once', 'return', 'print', 'unset')) . PHP_EOL; | |
// マジックメソッド | |
echo '[マジックメソッド]' . PHP_EOL . join($separator, array('__construct', '__destruct', '__call', '__callStatic', '__get', '__set', '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke', '__set_state', '__clone')) . PHP_EOL; | |
// 予約語 | |
echo '[予約語]' . PHP_EOL . join($separator, array('php', 'bool', 'boolean', 'double', 'float', 'int', 'integer', 'object', 'real', 'string', 'this', 'abstract', 'and', 'array', 'as', 'break', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'do', 'else', 'elseif', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'interface', 'instanceof', 'namespace', 'new', 'or', 'private', 'protected', 'public', 'static', 'switch', 'throw', 'try', 'use', 'var', 'while', 'xor')) . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment