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