3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<html> <body> <?php $x=5; // global scope function myTest() { $y=10; // local scope echo "<p>Test variables inside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; } myTest(); echo "<p>Test variables outside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; ?>
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<html> <body> <p>Test variables inside the function:<p> Notice: Undefined variable: x in /in/C03QI on line 11 Variable x is: <br>Variable y is: 10<p>Test variables outside the function:<p>Variable x is: 5<br> Notice: Undefined variable: y in /in/C03QI on line 21 Variable y is:
Output for 4.3.0 - 5.0.3
<html> <body> <p>Test variables inside the function:<p> Notice: Undefined variable: x in /in/C03QI on line 11 Variable x is: <br>Variable y is: 10<p>Test variables outside the function:<p>Variable x is: 5<br> Notice: Undefined variable: y in /in/C03QI on line 21 Variable y is: