Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $text = trim($_GET['text']);
- $red = dechex((int) trim($_GET['red']));
- $green = dechex((int) trim($_GET['green']));
- $blue = dechex((int) trim($_GET['blue']));
- $n = (int) trim($_GET['nth']);
- $color = str_pad($red, 2, '0', STR_PAD_LEFT) . str_pad($green, 2, '0', STR_PAD_LEFT) . str_pad($blue, 2, '0', STR_PAD_LEFT);
- $result = '<p>';
- for ($i = 0; $i < strlen($text); $i++) {
- if (($i + 1) % $n == 0) {
- $result .= '<span style="color: #' . strtolower($color) . '">' . htmlspecialchars($text[$i]) . '</span>';
- } else {
- $result .= htmlspecialchars($text[$i]);
- }
- }
- $result .= '</p>';
- echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement