PHP output Current Process all variables/constants/modules/functions/Classes

Source: Internet
Author: User

1. Get_defined_vars (PHP 4 >= 4.0.4, PHP 5) -Gets an array of all defined variables

Array get_defined_vars ( void)

This function returns a multidimensional array that contains a list of all defined variables, including environment variables, server variables, and user-defined variables.

<?PHPEcho' <pre> '; $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 for a 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 is empty and does not require any arguments

    <? 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)- get all available modules

    <? PHP       Echo ' <pre> ';             Print_r (get_loaded_extensions());      ? >  

4. Get_extension_funcs (PHP 4, PHP 5)-Get the available functions for the specified module

    <? PHP       Echo ' <pre> ';         // array Get_extension_funcs (string $module _name) This function returns all available functions for the specified module. The parameters passed in (module name) must be lowercase    print_r(get_extension_funcs("GD"))      ; Print_r (get_extension_funcs("xml"));       >  

5. Get_defined_constants (PHP 4 >= 4.1.0, PHP 5)-Gets the name of the associative array all constants and their value

array   get_defined_constants   ([ < Span class= "type" >bool  $categorize  = false ])

    <? PHP       Echo ' <pre> ';             Define ("My_constant", 1);       Print_r (get_defined_constants(true));      ? >  

6. Get_declared_classes (PHP 4, PHP 5)-Gets an array of the names of the defined classes

Array get_declared_classes ( void)

<?PHPEcho' <pre> '; //define Classone    classClassone {}//define Classtwo    classClasstwo {}//This would show X classes (built-ins, extensions etc) with//classone and Classtwo as the last of the elements          Print_r(get_declared_classes()); //define Classthree    classClassthree {}//... and four    classClassfour {}//shows the same result as before with class three and four appended    Print_r(get_declared_classes()); ?>

7. get_included_files () (or get_require_files) (PHP 4, PHP 5)-Gets an array of the names of the defined classes

<?PHP//This file is abc.php  include' Test1.php '; include_once' Test2.php '; require' Test3.php '; require_once' Test4.php '; $included _files=Get_included_files(); foreach($included _files  as $filename) {      Echo"$filename\ n "; }    ?>

PHP output Current Process all variables/constants/modules/functions/Classes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.