3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php session_start(); if (!isset($_SESSION)) { header("Location:input.php"); } else { $greeting = "Welcome " .$_SESSION["username"]. ", let's string your strings " .$_SESSION["s1"]. " and " .$_SESSION["s2"]. "!"; if (!isset($_GET["conxy"])) { $conxvar = ""; // function to conx+y with GET and append parameter to URL } else { $conxvar = "The strings x+y have been concatenated: ". $_SESSION["s1"].$_SESSION["s2"]; echo $conxvar; } if (!isset($_GET["conyx"])) { $conyvar = ""; // function to conx+y with GET and append parameter to URL } else { $conyvar = "The strings y+x have been concatenated: ". $_SESSION["s2"].$_SESSION["s1"]; echo $conyvar; } if (!isset($_GET["conyx"])) { $subvar = ""; // function to check substring with GET and append parameter to URL } else { $compareX = strpos($_SESSION["s2"], $_SESSION["s1"]); $compareY = strpos($_SESSION["s1"], $_SESSION["s2"]); if ($compareX !== false) { $subvar = "String ".$_SESSION["s1"]. " is a substring of " .$_SESSION["s2"]; } else { $subvar = "String ".$_SESSION["s1"]. " is NOT a substring of " .$_SESSION["s2"]; } if ($compareY !== false) { $subvar += " and string ".$_SESSION['s2']. " is a substring of " .$_SESSION['s1']; } else { $subvar += " and string ".$_SESSION['s2']. " is NOT a substring of " .$_SESSION['s1']; } echo $subvar; } //} ?> <!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery-1.11.0.js"></script> <script type="text/javascript"></script></head> <body> <div id="greeting" value=<?php echo $greeting ?> </div> <br/><br/> <input type="button" name="op" id="conxy" value="CON x+y"/> <div id="conx-y" value= <?php echo $conxvar ?> </div><br/><br/> <input type="button" name="op" id="conyx" value="CON y+x"/> <div id="cony-x" value= <?php echo $conyvar ?> </div><br/><br/> <input type="button" name="op" id="subxy" value="SUB XorY"/> <div id="subxoy" value= <?php echo $subvar ?> </div><br/><br/> <script> (function() { $('#conx-y').hide(); $('#cony-x').hide(); $('#subxoy').hide(); $('#conxy').click(function() { //e.preventDefault(); $.ajax({ url: 'strings.php', type: 'GET', dataType: 'json', data: $(this).serialize(), success: function(data) { $('#conx-y').html(data); $('#conx-y').show(); } }); }); $('#conyx').click(function() { //e.preventDefault(); $.ajax({ url: 'strings.php', type: 'GET', dataType: 'json', data: $(this).serialize(), success: function(data) { $('#cony-x').html(data); $('#cony-x').show(); } }); }); })(); </script> </body> </html>
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected end of file in /in/G5cat on line 146
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end in /in/G5cat on line 146
Process exited with code 255.