3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<html> <body> <?php $x=15; // global scope function myTest() { $y=25; // 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"; ?> </body> </html>
Output for 5.0.4 - 7.1.0
<html> <body> <p>Test variables inside the function:</p> Notice: Undefined variable: x in /in/skSVh on line 10 Variable x is: <br>Variable y is: 25<p>Test variables outside the function:</p>Variable x is: 15<br> Notice: Undefined variable: y in /in/skSVh on line 20 Variable y is: </body> </html>
Output for 4.3.0 - 5.0.3
<html> <body> <p>Test variables inside the function:</p> Notice: Undefined variable: x in /in/skSVh on line 10 Variable x is: <br>Variable y is: 25<p>Test variables outside the function:</p>Variable x is: 15<br> Notice: Undefined variable: y in /in/skSVh on line 20 Variable y is: </body> </html>