Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form>
- <textarea name="input"></textarea><br>
- <input type="submit" value="Color text">
- </form>
- <?php
- if (isset($_GET['input'])) {
- $chars = array_map("trim", str_split(htmlspecialchars($_GET['input'])));
- $chars = array_filter($chars);
- foreach ($chars as $char) {
- $check = ord($char);
- if ($check % 2 == 0)
- echo "<span style='color:red'>" . $char . " </span>";
- else
- echo "<span style='color:blue'>" . $char . " </span>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement