3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = $_POST["item"]; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <form method="post" action=""/> <input type="text" name="item"> <input type="submit" value="Yes, Add to Cart"> </form> <?php echo "<br/><br/><br/>" . "<b>".$name . "</b>"; ?> </body> </html>
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined index: REQUEST_METHOD in /in/XfYcL on line 2 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <form method="post" action=""/> <input type="text" name="item"> <input type="submit" value="Yes, Add to Cart"> </form> Notice: Undefined variable: name in /in/XfYcL on line 18 <br/><br/><br/><b></b></body> </html>
Output for 5.0.4 - 5.2.17
Notice: Undefined index: REQUEST_METHOD in /in/XfYcL on line 2 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <form method="post" action=""/> <input type="text" name="item"> <input type="submit" value="Yes, Add to Cart"> </form> Notice: Undefined variable: name in /in/XfYcL on line 18 <br/><br/><br/><b></b></body> </html>
Output for 4.3.0 - 5.0.3
Notice: Undefined index: REQUEST_METHOD in /in/XfYcL on line 2 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <form method="post" action=""/> <input type="text" name="item"> <input type="submit" value="Yes, Add to Cart"> </form> Notice: Undefined variable: name in /in/XfYcL on line 18 <br/><br/><br/><b></b></body> </html>