Show DevBest [PHP] Rainbow text

Status
Not open for further replies.

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
If you follow my releases/projects, you'll notice that I love creating random little scripts that may come in handy one day.

Well I've created a new one.

A script that creates rainbow coloured text.

Very easy usage:

PHP:
<?php
function RainbowText( $text )
{
$colours = array( "FF0000",
 "ff8400",
 "FFFF00",
 "0000FF",
 "00FF00",
 "5050cc",
 "7e2b71"
);
for( $z = 0; $z <= strlen( $text ); $z++ )
{
echo ( $text[ $z ] == " " ) ? " " : "<span style=\"color: #" . $colours[ mt_rand( 1, count( $colours ) ) ] . ";\">" . $text[ $z ] . "</span>";
}
}
echo RainbowText( "Hello, my name is m0nsta. (Mark Eriksson)" );
?>
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
I'm actually going to use this, right now. brb
EDIT:
Could you code something so that it changes the text to was a person inputs via form?
 
Status
Not open for further replies.

Users who are viewing this thread

Top