Advertisement
zhpapazov

Untitled

Mar 9th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Text Colorer</title>
  5. </head>
  6. <body>
  7. <form method="get">
  8. <input type="text" name="input">
  9. <input type="submit">
  10. </form>
  11.  
  12. <?php
  13. if (isset($_GET['input'])) {
  14. $input = $_GET['input'];
  15. $inputArr = explode(" ", $input);
  16. $inpNoSpace = implode("", $inputArr);
  17. for ($i = 0;$i < strlen($inpNoSpace);$i++) {
  18. if (ord($inpNoSpace[$i]) % 2 == 0) {
  19. echo "<font color='red'>$inpNoSpace[$i]</font>&nbsp;";
  20. } else {
  21. echo "<font color='blue'>$inpNoSpace[$i]</font>&nbsp;";
  22. }
  23. }
  24. }
  25. ?>
  26.  
  27. </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement