Share on Google+Share on Google+

PHP list all variables

In this part of the tutorial we will learn how to list all variables in context of PHP list.And we will also see the example related to the get_defined_vars() function and ArrayObject class

  • PHP all declared and environment variables can be listed
  • get_defined_vars() method returns all the variables in the form of array.
  • The array returned is handles by the class ArrayObject class.

Example of PHP List of all Variables

="new delhi";
= new ArrayObject(get_defined_vars());

($arr1 as $key=>$val)
"<br> key---->".$key." value------>".$val;

key---->GLOBALS value------>Array
key---->_ENV value------>Array
key---->HTTP_ENV_VARS value------>Array
key---->_POST value------>Array
key---->HTTP_POST_VARS value------>Array
key---->_GET value------>Array
key---->HTTP_GET_VARS value------>Array
key---->_COOKIE value------>Array
key---->HTTP_COOKIE_VARS value------>Array
key---->_SERVER value------>Array
key---->HTTP_SERVER_VARS value------>Array
key---->_FILES value------>Array
key---->HTTP_POST_FILES value------>Array
key---->_REQUEST value------>Array
key---->name value------>roseindia
key---->city value------>new delhi



Posted on: October 31, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null