Php outputs all variables, constants, modules, functions, and classes of the current process.

Source: Internet
Author: User
Php outputs all variables, constants, modules, functions, and classes of the current process.

  1. Echo'
    ';
  2. $ B = array );
  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 of the variable array
  9. Print_r (array_keys (get_defined_vars ()));
  10. ?>

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.

  1. Echo'
    ';  
  2. function foo()
  3. {
  4. echo "This is my function foo";
  5. }
  6. $arr = get_defined_functions();
  7. print_r($arr);
  8. ?>

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

  1. Echo'
    '; 
  2. print_r(get_loaded_extensions());
  3. ?>

4. get_extension_funcs(PHP 4, PHP 5)-Get the available function array get_extension_funcs (string $ module_name) of the specified module. This function returns all available functions of the specified module. The input parameter (module name) must be in lowercase.

  1. Echo'
    ';  
  2. print_r(get_extension_funcs("gd"));
  3. print_r(get_extension_funcs("xml"));
  4. ?>

5. get_defined_constants(PHP 4> = 4.1.0, PHP 5)-get the names of all constants associated with the array and their values. array get_defined_constants ([bool $ categorize = false])

  1. Echo'
    ';  
  2. define("MY_CONSTANT", 1);
  3. print_r(get_defined_constants(true));
  4. ?>

6. get_declared_classes(PHP 4, PHP 5)-Get the array get_declared_classes (void) consisting of the names of the defined classes)

  1. Echo'
    ';  
  2. //define classone
  3. class classone { }
  4. //define classtwo
  5. class classtwo { }
  6. //This will show X classes (built-ins, extensions etc) with
  7. //classone and classtwo as the last two 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());
  15. ?>

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.