GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nginx/html/JimMartinson/CST1146/Resources/Examples/Week/04/ |
Upload File : |
<!DOCTYPE html> <html lang="en"> <head> <title>Week 3 - 6.php</title> <meta charset="utf-8"> <body> <h1>Week 3 - 6.php</h1> Looking at scopre<br> <?php $x = 5; // global scope function myTest() { // using x inside this function will generate an error echo "<p>Variable x inside function is: $x</p>"; } myTest(); echo "<p>Variable x outside function is: $x</p>"; function myTest2() { $y = 5; // local scope echo "<p>Variable y inside function is: $y</p>"; } myTest2(); // using x outside the function will generate an error echo "<p>Variable y outside function is: $y</p>"; $x = 5; $y = 10; function myTest3() { $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y']; } myTest3(); echo $y; ?> <pre style="background-color:#afa;"><? var_dump($GLOBALS);?></pre> </body> </html>