3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<html> <head> </head> <title> </title> <body> <?php if (!$_POST['submit']) { ?> <form action="<?= $_SERVER['SELF_PHP'];?>" method="post" > Enter any Number:<input name="number" size="2"> <input type="submit" name="submit" value="OK!"> <?php } else { $number=$_POST['number']; if ($number >0) { echo 'You entered a positive number'; } elseif ($number < 0) { echo 'You entered a negative number'; } else { echo 'You entered zero'; } } ?> </body> </html>
Output for 5.4.0 - 7.1.0
<html> <head> </head> <title> </title> <body> Notice: Undefined index: submit in /in/QjBnH on line 6 <form action=" Notice: Undefined index: SELF_PHP in /in/QjBnH on line 8 " method="post" > Enter any Number:<input name="number" size="2"> <input type="submit" name="submit" value="OK!"> </body> </html>
Output for 5.3.0 - 5.3.29
<html> <head> </head> <title> </title> <body> Notice: Undefined index: submit in /in/QjBnH on line 6 <form action="<?= $_SERVER['SELF_PHP'];?>" method="post" > Enter any Number:<input name="number" size="2"> <input type="submit" name="submit" value="OK!"> </body> </html>
Output for 4.3.0 - 5.2.17
<html> <head> </head> <title> </title> <body> Notice: Undefined index: submit in /in/QjBnH on line 6 <form action="<?= $_SERVER['SELF_PHP'];?>" method="post" > Enter any Number:<input name="number" size="2"> <input type="submit" name="submit" value="OK!"> </body> </html>