PHP output The current process of all variable constants and other methods introduced

Source: Internet
Author: User
    1. Echo '
      ';     
    2. $b = Array (1,1,2,3,5,8);
    3. $arr = Get_defined_vars ();
    4. Print $b
    5. Print_r ($arr ["B"]);
    6. Print all server variables
    7. Print_r ($arr ["_server"]);
    8. Print all available key values for a variable array
    9. Print_r (Array_keys (Get_defined_vars ()));
Copy Code

2. Get_defined_functions (PHP 4 >= 4.0.4, PHP 5)-Get all the functions that have been defined array get_defined_functions (void)//void is empty, no parameters are required

    1. Echo '
      ';      
    2. function foo ()
    3. {
    4. echo "This is my function foo";
    5. }
    6. $arr = Get_defined_functions ();
    7. Print_r ($arr);
Copy Code

3. Get_loaded_extensions (PHP 4, PHP 5)-Get all available modules

    1. Echo '
      ';      
    2. Print_r (Get_loaded_extensions ());
Copy Code

4. Get_extension_funcs (PHP 4, PHP 5)-Gets the available functions of the specified module array get_extension_funcs (string $module _name) The function returns all available functions for the specified module. The parameter passed in (module name) must be lowercase

    1. Echo '
      ';      
    2. Print_r (Get_extension_funcs ("GD"));
    3. Print_r (Get_extension_funcs ("xml"));
Copy Code

5. Get_defined_constants (PHP 4 >= 4.1.0, PHP 5)-Gets the name of the associated array all constants and their value array get_defined_constants ([bool $categorize = False])

    1. Echo '
      ';      
    2. Define ("My_constant", 1);
    3. Print_r (Get_defined_constants (true));
Copy Code

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

    1. Echo '
      ';      
    2. Define Classone
    3. Class Classone {}
    4. Define Classtwo
    5. Class Classtwo {}
    6. This'll show X classes (built-ins, extensions etc) with
    7. Classone and Classtwo as the last of the elements
    8. Print_r (Get_declared_classes ());
    9. Define Classthree
    10. Class Classthree {}
    11. ... and four
    12. Class Classfour {}
    13. Shows the same result as before with class three and four appended
    14. Print_r (Get_declared_classes ());
Copy Code
  • 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.