3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); if (!isset($_SESSION["username"]) && !isset($_SESSION["s1"]) && !isset($_SESSION["s2"])) { header("Location:input.php"); } else { ini_set('display_errors', 'On'); $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; } }

preferences:
32.17 ms | 402 KiB | 5 Q