3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); if ((!isset($_SESSION["username"]) && !isset($_SESSION["s1"]) && !isset($_SESSION["s2"]))) { $_SESSION["firstrun"] = "true"; $_POST = array(); } ?> <!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery-1.11.0.js"></script> </head> <script> $(function() { $('#enter').click(function() { console.log("clicky"); //Debug //Get value from the inputs var user_input = $("#username").val(); var s1_input = $("#s1").val(); var s2_input = $("#s2").val(); //Make a jquery post to the session.php with the users data and then redirect to the next page jQuery.post("session.php", {username:user_input, s1:s1_input, s2:s2_input}, function(data){ if (data == "true") { window.location.replace("strings.php"); // Javascript redirect } }); }); }); </script> <body> Enter a username: <input type="text" name="username" id="username" value=""/> <br/> <br/> Pick a string: <input type="text" name="s1" id="s1" value=""/> <br/> <br/> Pick another string: <input type="text" name="s2" id="s2" value=""/> <br/> <br/> <input type="button" name="enter" id="enter" value="Go play with strings!"/> <br/> <br/> </body> </html>
Output for 5.2.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery-1.11.0.js"></script> </head> <script> $(function() { $('#enter').click(function() { console.log("clicky"); //Debug //Get value from the inputs var user_input = $("#username").val(); var s1_input = $("#s1").val(); var s2_input = $("#s2").val(); //Make a jquery post to the session.php with the users data and then redirect to the next page jQuery.post("session.php", {username:user_input, s1:s1_input, s2:s2_input}, function(data){ if (data == "true") { window.location.replace("strings.php"); // Javascript redirect } }); }); }); </script> <body> Enter a username: <input type="text" name="username" id="username" value=""/> <br/> <br/> Pick a string: <input type="text" name="s1" id="s1" value=""/> <br/> <br/> Pick another string: <input type="text" name="s2" id="s2" value=""/> <br/> <br/> <input type="button" name="enter" id="enter" value="Go play with strings!"/> <br/> <br/> </body> </html>
Output for 4.4.3 - 5.2.2
<br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in <b>/in/BaVg1</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/BaVg1:2) in <b>/in/BaVg1</b> on line <b>2</b><br /> <!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery-1.11.0.js"></script> </head> <script> $(function() { $('#enter').click(function() { console.log("clicky"); //Debug //Get value from the inputs var user_input = $("#username").val(); var s1_input = $("#s1").val(); var s2_input = $("#s2").val(); //Make a jquery post to the session.php with the users data and then redirect to the next page jQuery.post("session.php", {username:user_input, s1:s1_input, s2:s2_input}, function(data){ if (data == "true") { window.location.replace("strings.php"); // Javascript redirect } }); }); }); </script> <body> Enter a username: <input type="text" name="username" id="username" value=""/> <br/> <br/> Pick a string: <input type="text" name="s1" id="s1" value=""/> <br/> <br/> Pick another string: <input type="text" name="s2" id="s2" value=""/> <br/> <br/> <input type="button" name="enter" id="enter" value="Go play with strings!"/> <br/> <br/> </body> </html>
Output for 4.3.2 - 4.4.2
<br /> <b>Warning</b>: session_start(): Cannot send session cookie - headers already sent in <b>/in/BaVg1</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/BaVg1:2) in <b>/in/BaVg1</b> on line <b>2</b><br /> <!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery-1.11.0.js"></script> </head> <script> $(function() { $('#enter').click(function() { console.log("clicky"); //Debug //Get value from the inputs var user_input = $("#username").val(); var s1_input = $("#s1").val(); var s2_input = $("#s2").val(); //Make a jquery post to the session.php with the users data and then redirect to the next page jQuery.post("session.php", {username:user_input, s1:s1_input, s2:s2_input}, function(data){ if (data == "true") { window.location.replace("strings.php"); // Javascript redirect } }); }); }); </script> <body> Enter a username: <input type="text" name="username" id="username" value=""/> <br/> <br/> Pick a string: <input type="text" name="s1" id="s1" value=""/> <br/> <br/> Pick another string: <input type="text" name="s2" id="s2" value=""/> <br/> <br/> <input type="button" name="enter" id="enter" value="Go play with strings!"/> <br/> <br/> </body> </html>
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: session_start() [<a href='http://www.php.net/function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in <b>/in/BaVg1</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start() [<a href='http://www.php.net/function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/BaVg1:2) in <b>/in/BaVg1</b> on line <b>2</b><br /> <!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery-1.11.0.js"></script> </head> <script> $(function() { $('#enter').click(function() { console.log("clicky"); //Debug //Get value from the inputs var user_input = $("#username").val(); var s1_input = $("#s1").val(); var s2_input = $("#s2").val(); //Make a jquery post to the session.php with the users data and then redirect to the next page jQuery.post("session.php", {username:user_input, s1:s1_input, s2:s2_input}, function(data){ if (data == "true") { window.location.replace("strings.php"); // Javascript redirect } }); }); }); </script> <body> Enter a username: <input type="text" name="username" id="username" value=""/> <br/> <br/> Pick a string: <input type="text" name="s1" id="s1" value=""/> <br/> <br/> Pick another string: <input type="text" name="s2" id="s2" value=""/> <br/> <br/> <input type="button" name="enter" id="enter" value="Go play with strings!"/> <br/> <br/> </body> </html>