-
- echo '
';
- $b = array(1,1,2,3,5,8);
- $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 ()));
- ?>
Copy code
2. get_defined_functions (PHP 4 >= 4.0.4, PHP 5) — Get all defined functions
array get_defined_functions (void) //void means empty and does not require any parameters
-
- echo '
';
- function foo()
- {
- echo "This is my function foo";
- }
- $arr = get_defined_functions();
- print_r($ arr);
-
- ?>
Copy code
3. get_loaded_extensions (PHP 4, PHP 5) — Get all available modules
-
- echo '
';
- print_r(get_loaded_extensions());
- ?>
Copy code
4. get_extension_funcs (PHP 4, PHP 5) — Get the available functions of the specified module
array get_extension_funcs (string $module_name) This function returns all available functions of the specified module. The parameters passed in (module names) must be lowercase
-
- echo '
';
- print_r(get_extension_funcs("gd"));
- print_r(get_extension_funcs("xml"));
- ?>
Copy code
5. get_defined_constants (PHP 4 >= 4.1.0, PHP 5) — Get the names of all constants in an associative array and their values
array get_defined_constants ([ bool $categorize = false ] )
-
- echo '
';
- define("MY_CONSTANT", 1);
- print_r(get_defined_constants(true));
- ?>
Copy code
6. get_declared_classes (PHP 4, PHP 5) — Get an array consisting of the names of defined classes
array get_declared_classes ( void )
-
- 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());
- ?>
Copy code
|