for is like a while().. loop, but with a predetermined number of cycles.
broken down, this example,
$i=0; (start with $i equal to zero)
$i<$review_rating (loop until $i is equal to or greater than $movie rating)
$i++ (increment $i by one each cycle)
and equivalent while() loop would look like:
$i = 0;
while ($i < $review_rating)
{
$movie_rating .= "<img src='thumbsup.gif'> ";
$i++;
}
return $movie_rating;
|