i'm unsure if i need to use an array (i'm a newbie to php, the most i've done is make text appear in random color)... anyhow, i want to pass a string to a function that will decrement a color value for each character. here is what i have so far...

<?
function red($str) {  
$red = rand(60, 99) 
                  /** first 2 of the six hex code numbers
                    * the other 4 will be light grey (neutral)
                    * so the string will fade or darken
                    * from the first red value 
                    **/

for (....) // need help here !

echo(....)  // i've got this part figured
}

thanks

for ($i = 0; $i< MAXLOOPS; $i++) or you could use a NULL string in an array to indicate the end and get this: while ($string[$i] != "") ($i is the string you're looking at now)

I'm not 100% sure about the code working, but the idea is sound.

thanks, i will work with your code. it looks easy the way you have written it, while the tutorials for php arrays seem really obscure.

tho i did realize it's 100% easier to just make an <img src...> file to do what i had in mind.

but i'm learning :-) thanks

for($i = 0; $str[$i] != ""; $i++) ---works great, thanks! :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.