IS 337: Website Administration

Lecture for October 24: PHP: for, if, function

+
-

Topics

for, if, function

  • for loop
  • integers and arithmetic
  • variables toggle
    • stupid sigil
    • untyped
    • undeclared (often)
  • if statement
  • functions

Quick Written Assignment for Next Time

Write a PHP loop to print out every "pure" red color. That is, generate a list item for a red value between 0 and 255 (inclusive), but always keep the green and blue contributions 0. The content of the list item should calculate the approximate red percentage. For example, here's one entry in the list:

<li style="color: rgb(23, 0, 0)">9.0% pure red</li>

Do not worry about the precission of the percentage, but do worry about computing the proper percentage (i.e., divided by 255 and multiplied by 100).

Creative © 2007 Calvin College and Jeremy D. Frens.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.