fork download
  1. <?php
  2.  
  3. $x = 5; // global scope
  4.  
  5. function myTest() {
  6. // using x inside this function will generate an error
  7. echo "<p>Variable x inside function is: $x</p>";
  8. }
  9. myTest();
Success #stdin #stdout #stderr 0.03s 26080KB
stdin
Standard input is empty
stdout
<p>Variable x inside function is: </p>
stderr
PHP Notice:  Undefined variable: x in /home/7wMZWk/prog.php on line 7