PHP: How do i return the value of $X in a function when $X was set in another function?

As a general rule, PHP does not support global variables (variables that can
automatically be accessed from any scope). However, certain special internal
variables behave like global variables similar to other languages. These variables
are called superglobals and are predefined by PHP for you to use. Some
examples of these superglobals are
☞ $_GET[]. An array that includes all the GET variables that PHP received
from the client browser.
☞ $_POST[]. An array that includes all the POST variables that PHP received
from the client browser.
☞ $_COOKIE[]. An array that includes all the cookies that PHP received from
the client browser.
☞ $_ENV[]. An array with the environment variables.
☞ $_SERVER[]. An array with the values of the web-server variables.
 
Back
Top