[prev] [index] [next]

Variables

Lifetime of variables is the current script/function.

Variables defined outside any function:

  • have global scope (over whole to script)
  • but are not accessible within functions unless "requested":

    function f() { global $max_num, $colour; .... }
    

Pre-defined "Super-global" arrays (e.g. $_SERVER, ...):
  • contain "environment" values (server ENV, CGI params, etc.)
  • are accessible from anywhere in the script