PHP outputs all variables, constants, modules, functions, and classes of the current process.
1. get_defined_vars(PHP 4> = 4.0.4, PHP 5)-Get an array composed of all defined Variables
Array get_defined_vars (void)
This function returns a multidimensional array containing the list of all Defined variables, including environment variables, server variables, and User-Defined variables.
The Code is as follows:
Echo'
';
$ B = array );
$ Arr = get_defined_vars ();
// Print $ B
Print_r ($ arr ["B"]);
// Print all server Variables
Print_r ($ arr ["_ SERVER"]);
// Print all available key values of the variable array
Print_r (array_keys (get_defined_vars ()));
?>
2. get_defined_functions(PHP 4> = 4.0.4, PHP 5)-Get all defined functions
Array get_defined_functions (void) // void indicates that it is null and no parameter is required.
Echo'';
Function foo ()
{
Echo "This is my function foo ";
}
$ Arr = get_defined_functions ();
Print_r ($ arr );
?>
3. get_loaded_extensions(PHP 4, PHP 5)-Get all available modules
The Code is as follows:
Echo'
';
Print_r (get_loaded_extensions ());
?>
4. get_extension_funcs(PHP 4, PHP 5)-obtain available functions of a specified Module
Array get_extension_funcs (string $ module_name) This function returns all available functions of the specified module. The input parameter (Module name) must be in lowercase.
The Code is as follows:
Echo'
';
Print_r (get_extension_funcs ("gd "));
Print_r (get_extension_funcs ("xml "));
?>
5. get_defined_constants(PHP 4> = 4.1.0, PHP 5)-Get the names of associated arrays, all constants, and their values
Array get_defined_constants ([bool $ categorize = false])
The Code is as follows:
Echo'
';
Define ("MY_CONSTANT", 1 );
Print_r (get_defined_constants (true ));
?>
6. get_declared_classes(PHP 4, PHP 5)-Get an array composed of the names of the defined classes
Array get_declared_classes (void)
The Code is as follows:
Echo'
';
//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());
?>