Login | Register | FAQ
Anonymous

Conditions

+ Post a reply

2 posts Page 1 of 1


Conditions

by chetanvthu » Wed Oct 10, 2012 2:49 pm

I found error in how do you insert comments script due to spaces between character-$ intGreen, intBlue and missed semi colon in a line ($strColor = "rgb(" . $intRed . "," . $intGreen . "," . $intBlue . ")" ). After correction as under i got the perfect result



<html>
<head>
<title>Loops</title>
</head>
<body>
<?php

// Here we write color codes using three loops

// Red can be between 0 and 255
for ($intRed=0; $intRed<=255; $intRed=$intRed+30) {

// Green can be between 0 and 255
for ($intGreen=0; $intGreen<=255; $intGreen=$intGreen+30) {

// Blue can be between 0 and 255
for ($intBlue=0; $intBlue<=255; $intBlue=$intBlue+30) {

// The color code is made on the form rgb(red,green,blue)
$strColor = "rgb(" . $intRed . "," . $intGreen . "," . $intBlue . ")";

// Now we write the color code to the client
echo "<span style='color:" . $strColor . "'> " . $strColor . " </span>";

// Closes the loops
}
}
}

?>

I think it was the correct.
User avatar

chetanvthu

  • Posts: 1
  • Joined: Wed Oct 10, 2012 12:04 pm

Re: Conditions

by XainPro » Thu Oct 11, 2012 10:44 am

thanks for your informative and correct post !
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm


+ Post a reply

Page 1 of 1