@ 2014-05-16T15:44:32Z <?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>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.28 0.000 0.050 19.16 5.4.27 0.010 0.060 19.19 5.4.26 0.000 0.047 18.79 5.4.25 0.000 0.083 19.15 5.4.24 0.003 0.050 18.91 5.4.23 0.007 0.073 19.14 5.4.22 0.007 0.040 18.80 5.4.21 0.013 0.067 18.80 5.4.20 0.007 0.073 19.19 5.4.19 0.013 0.073 18.79 5.4.18 0.003 0.043 18.96 5.4.17 0.007 0.073 19.07 5.4.16 0.007 0.057 19.06 5.4.15 0.007 0.037 19.11 5.4.14 0.003 0.047 16.39 5.4.13 0.000 0.050 16.24 5.4.12 0.010 0.063 16.37 5.4.11 0.007 0.067 16.31 5.4.10 0.003 0.047 16.49 5.4.9 0.007 0.033 16.16 5.4.8 0.007 0.033 16.22 5.4.7 0.003 0.040 16.31 5.4.6 0.010 0.060 16.23 5.4.5 0.007 0.067 16.38 5.4.4 0.007 0.070 16.21 5.4.3 0.007 0.043 16.38 5.4.2 0.013 0.033 16.27 5.4.1 0.003 0.053 16.27 5.4.0 0.013 0.027 15.71 5.3.28 0.003 0.043 14.54 5.3.27 0.007 0.050 14.57 5.3.26 0.003 0.050 14.55 5.3.25 0.010 0.033 14.41 5.3.24 0.003 0.077 14.57 5.3.23 0.003 0.063 14.55 5.3.22 0.003 0.047 14.41 5.3.21 0.007 0.033 14.54 5.3.20 0.000 0.043 14.52 5.3.19 0.003 0.040 14.52 5.3.18 0.013 0.043 14.52 5.3.17 0.010 0.030 14.49 5.3.16 0.007 0.063 14.67 5.3.15 0.010 0.073 14.67 5.3.14 0.007 0.047 14.39 5.3.13 0.003 0.070 14.54 5.3.12 0.007 0.057 14.49 5.3.11 0.000 0.040 14.45 5.3.10 0.000 0.047 13.98 5.3.9 0.007 0.077 13.97 5.3.8 0.010 0.060 14.00 5.3.7 0.013 0.070 13.99 5.3.6 0.010 0.043 13.98 5.3.5 0.007 0.033 13.89 5.3.4 0.007 0.067 13.99 5.3.3 0.013 0.060 13.85 5.3.2 0.003 0.043 13.80 5.3.1 0.007 0.033 13.64 5.3.0 0.000 0.080 13.74
preferences:dark mode live preview
141.27 ms | 1386 KiB | 7 Q