sudhakarinfotech
(current)
Run Code
PHP Code Editor-
PHP Source Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PHP Global Variable Scope</title> </head> <body> <h1>PHP Global Variable Scope</h1> <?php $user = 'Ankita Maurya'; $job = 'Design & Developement'; function websiteName(){ echo $user; echo $job."<br>"; //Normally global variable can not be access inside the function } websiteName(); //gloval variable can be access out side of the function echo $user." Working in the field of ".$job; ?> </body> </html>
Source Code Output