<?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();
Standard input is empty
<p>Variable x inside function is: </p>
PHP Notice: Undefined variable: x in /home/7wMZWk/prog.php on line 7