Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Text Colorer</title>
- </head>
- <body>
- <form method="get">
- <input type="text" name="input">
- <input type="submit">
- </form>
- <?php
- if (isset($_GET['input'])) {
- $input = $_GET['input'];
- $inputArr = explode(" ", $input);
- $inpNoSpace = implode("", $inputArr);
- for ($i = 0;$i < strlen($inpNoSpace);$i++) {
- if (ord($inpNoSpace[$i]) % 2 == 0) {
- echo "<font color='red'>$inpNoSpace[$i]</font> ";
- } else {
- echo "<font color='blue'>$inpNoSpace[$i]</font> ";
- }
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement