PHP | get_defined_vars() Function Last Updated : 27 Nov, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The get_defined_vars() function is an inbuilt function in PHP which is used to returns an array of all defined variables. This function returns a multidimensional array which contains all the list of variables, environment etc. Syntax: array get_defined_vars( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns a multidimensional array of all the variables. Below program illustrates the get_defined_vars() function in PHP: Program: PHP <?php // Declare an array and initialize it $a = array(0, 1, 2, 3, 4); // Use get_defined_vars() function $a = get_defined_vars(); // Display the output print_r($a); ?> Output: Array ( [_GET] => Array ( ) [_POST] => Array ( ) [_COOKIE] => Array ( ) [_FILES] => Array ( ) [argv] => Array ( [0] => /home/9485b6f3bafb5e0e7b2d4580a85e639d.php ) [argc] => 1 [_SERVER] => Array ( [PHP_SELF] => /home/9485b6f3bafb5e0e7b2d4580a85e639d.php [SCRIPT_NAME] => /home/9485b6f3bafb5e0e7b2d4580a85e639d.php [SCRIPT_FILENAME] => /home/9485b6f3bafb5e0e7b2d4580a85e639d.php [PATH_TRANSLATED] => /home/9485b6f3bafb5e0e7b2d4580a85e639d.php [DOCUMENT_ROOT] => [REQUEST_TIME_FLOAT] => 1543316494.2727 [REQUEST_TIME] => 1543316494 [argv] => Array ( [0] => /home/9485b6f3bafb5e0e7b2d4580a85e639d.php ) [argc] => 1 ) [a] => Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 ) ) Reference: http://php.net/manual/en/function.get-defined-vars.php Comment More infoAdvertise with us Next Article PHP define() Function S sahil_rajput Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | defined() function The PHP defined() function is an inbuilt function in PHP which checks whether a constant is exists or not, in other words, defined or not. Syntax: bool defined($constant_name); Parameter: This function accepts a single parameter as mentioned above and described below. $constant_name: This is require 1 min read PHP get_class_vars() Function The get_class_vars() function is an inbuilt function in PHP which is used to get the default properties of a class. Syntax: array get_class_vars(string $class)Parameters: This function accepts one parameter that is described below: $class: This parameter specifies the name of the class.Return Value: 1 min read PHP define() Function The define() function is basically used by programmers to create constant. Constants in PHP are very similar to variables and the only difference between both are the values of constants can not be changed once it is set in a program. define() returns a Boolean value. It will return TRUE on success 2 min read PHP get_defined_constants() Function The get_defined_constants() function is an inbuilt function in PHP that returns the name of all the constants that are currently defined with their values in the form of an associative array. Syntax: get_defined_constants(bool $categorize = false): arrayParameter: This function accepts single parame 2 min read PHP get_defined_functions() Function The get_defined_functions() function is an inbuilt function in PHP which returns the all defined functions in the array format. Syntax: array get_defined_functions( bool $exclude_disabled = true )Parameters: This function accepts one parameter that is described below: $exclude_disabled: It will chec 2 min read PHP | filter_has_var() function The filter_has_var() function is an inbuilt function in PHP which is used to check whether the variable available or not especially it checks if a variable of a specified input type exist or not. It returns True on success or False on failure. Syntax: bool filter_has_var( $type, $variable_name ) Par 2 min read Like