PHP outputs all variables/constants/modules/functions/classes of the current process

Source: Internet
Author: User
PHP outputs all variables of the current process. constant module function class 1 .? Get_defined_vars ?? (PHP4 & gt; 4.0.4, PHP5 )? -Get an array composed of all defined variables? Array? Get_defined_vars? (? Void ?)? This function returns a multidimensional array containing a list of all defined variables, including environment variables, server variables, and all the variables/constants/modules/functions/classes of the current process output by PHP.

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.

?

 '; $ B = array (,); $ arr = get_defined_vars (); // Print $ bprint_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 )? -? Obtain all defined functions

?

Array get_defined_functions (void) // void indicates that it is null and no parameter is required.

?

 ';function foo(){    echo "This is my function foo";}$arr = get_defined_functions();print_r($arr);?>

?

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

?

 ';print_r(get_loaded_extensions());?>
?

4 .? Get_extension_funcs? (PHP 4, PHP 5 )? -? Obtains 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.

?

 ';print_r(get_extension_funcs("gd"));print_r(get_extension_funcs("xml"));?>
?

5 .? Get_defined_constants? (PHP 4> = 4.1.0, PHP 5 )? -? Obtain the names of associated arrays, all constants, and their values.

?

Array?Get_defined_constants? ([? Bool?$categorize? = False?] )

?

 ';define("MY_CONSTANT", 1);print_r(get_defined_constants(true));?>
?

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

?

Array?Get_declared_classes? (? Void ?)

?

 ';//define classoneclass classone { }//define classtwoclass classtwo { }//This will show X classes (built-ins, extensions etc) with//classone and classtwo as the last two elementsprint_r(get_declared_classes());//define classthreeclass classthree { }//...and fourclass classfour { }//Shows the same result as before with class three and four appendedprint_r(get_declared_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.