fork download
  1. <html>
  2. <body>
  3. <form method="POST">
  4. Enter first string:
  5. <input type="text" name="str1"><br><br>
  6. Enter second string:
  7. <input type="text" name="str2"><br><br>
  8. <input type="submit" name="submit">
  9. </form>
  10. </body>
  11. </html>
  12. <?php
  13. if($_POST)
  14. {
  15. $s1=$_POST['str1'];
  16. $s2=$_POST['str2'];
  17. $length=strlen($s1);
  18. echo "<br><br>The length of given string $s1 is:<br><br>".$length."<br><br>";
  19.  
  20. $upper=strtoupper($s1);
  21. echo "The uppercase of given string $s1 is:<br><br>".$upper."<br><br>";
  22.  
  23. $lower=strtolower($s1);
  24. echo "The lowercase of given string $s1 is:<br><br>".$lower."<br><br>";
  25.  
  26. $rev=ucfirst($s1);
  27. echo "The ucfirst of given string $s1 is:<br><br>".$rev."<br><br>";
  28.  
  29. $substring=substr($s1,3);
  30. echo "The substring of the given string $s1 is $substring<br><br>";
  31.  
  32. $trimmed=trim($s1);
  33. echo $trimmed."<br><br>";
  34.  
  35. $compare=strcmp($s1,$s2);
  36. if($compare==0)
  37. echo "The string $s1 and $s2 are equal<br><br>";
  38. else
  39. echo "The string $s1 and $s2 are not equal<br><br>";
  40. }
  41. ?>
Success #stdin #stdout 0.02s 25136KB
stdin
Standard input is empty
stdout
<html>
<body>
<form method="POST">
Enter first string:
<input type="text" name="str1"><br><br>
Enter second string:
<input type="text" name="str2"><br><br>
<input type="submit" name="submit">
</form>
</body>
</html>