PHP Global Variables

Global Variables:

Global Variables can be accessed in anywhere in program. These can be called or used across the process or sub process that is with in the program. Global variables can be overridden at runtime.

Example

<?php
$website = "http://www.programmersbank.com";

function addit() {
GLOBAL $website;

print "Website is $website";
}
addit();
?>
This will produce following result.
Website is http://www.programmersbank.com

Bookmark This Page

Link Partners