Created
August 21, 2015 02:37
-
-
Save ravelll/f59955ceed3c522d998d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| $keywords = array( | |
| 'if', 'else', 'elseif', 'endif', 'while', 'endwhile', 'do', 'as', 'for', 'endfor', 'foreach', 'endforeach', | |
| 'break', 'continue', 'switch', 'endswitch', 'case', 'default', 'declare', 'enddeclare', | |
| 'try', 'catch', 'return', 'exit', 'const', 'class', 'function', | |
| 'require', 'include', 'require_once', 'include_once', | |
| 'abstract', 'final', 'interface', 'private', 'protected', 'public', 'static', | |
| '__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__', '__METHOD__', '__NAMESPACE__' | |
| ); | |
| $functions = function_exists( 'get_defined_functions' ) ? get_defined_functions() : array(); | |
| $constants = function_exists( 'get_defined_constants' ) ? get_defined_constants() : array(); | |
| $interfaces = function_exists( 'get_declared_interfaces' ) ? get_declared_interfaces() : array(); | |
| $classes = function_exists( 'get_declared_classes' ) ? get_declared_classes() : array(); | |
| $arrays = array_merge( | |
| $keywords, | |
| $functions['internal'], | |
| array_keys( $constants ), // 定数を補完したい場合はこの行を有効にする | |
| $interfaces, | |
| $classes | |
| ); | |
| sort( $arrays ); | |
| $arrays = array_unique( $arrays ); | |
| echo implode( "\n", $arrays ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment