1. get_defined_vars (PHP 4 >= 4.0.4, PHP 5) — 获取由全部已定义变量所组成的数组php
array get_defined_vars ( void )数组
此函数返回一个包含全部已定义变量列表的多维数组,这些变量包括环境变量、服务器变量和用户定义的变量。服务器
<?php echo '<pre>'; $b = array(1,1,2,3,5,8); $arr = get_defined_vars(); // 打印 $b print_r($arr["b"]); // 打印全部服务器变量 print_r($arr["_SERVER"]); // 打印变量数组的全部可用键值 print_r(array_keys(get_defined_vars())); ?>
2. get_defined_functions (PHP 4 >= 4.0.4, PHP 5) — 获取全部已经定义的函数app
array get_defined_functions ( void ) //void 表示为空,不须要任何参数函数
<?php echo '<pre>'; function foo() { echo "This is my function foo"; } $arr = get_defined_functions(); print_r($arr); ?>
3. get_loaded_extensions (PHP 4, PHP 5) — 获取全部可用的模块ui
<?php echo '<pre>'; print_r(get_loaded_extensions()); ?>
4. get_extension_funcs (PHP 4, PHP 5) — 获取指定模块的可用函数spa
array get_extension_funcs ( string $module_name
) 该函数返回指定模块全部可用的函数。传入的参数(模块名称)必须是小写code
<?php echo '<pre>'; print_r(get_extension_funcs("gd")); print_r(get_extension_funcs("xml")); ?>
5. get_defined_constants (PHP 4 >= 4.1.0, PHP 5) — 获取关联数组的名字全部的常量和他们的价值xml
array get_defined_constants ([ bool $categorize
= false ] )three
<?php echo '<pre>'; define("MY_CONSTANT", 1); print_r(get_defined_constants(true)); ?>
6. get_declared_classes (PHP 4, PHP 5) — 获取由已定义类的名字所组成的数组
array get_declared_classes ( void )
<?php echo '<pre>'; //define classone class classone { } //define classtwo class classtwo { } //This will show X classes (built-ins, extensions etc) with //classone and classtwo as the last two elements print_r(get_declared_classes()); //define classthree class classthree { } //...and four class classfour { } //Shows the same result as before with class three and four appended print_r(get_declared_classes()); ?>