CS 161 - Introduction to Programming with PHP

Lecture Notes: 04 Oct 2010
 

Integrating PHP into web pages

  • Opening and closing tags
  • Advanced escaping
    <?php if ($expression) { ?> <strong>This is true.</strong> <?php } else { ?> <strong>This is false.</strong> <?php } ?>

Predefined variables:

  • $_GET and $_POST
  • $_SERVER

Assignment #4 Due: Wednesday 06 October

Write a program that converts Roman numerals to their decimal value. Your program should recognize the Roman numerals I, V, X, L, C, D, and M, which have the decimal values of 1, 5, 10, 50, 100, 500, and 1000 respectively.

Most importantly, your program must understand the subtractive forms such as IX (9) or CM (900).

Your program may be designed to run from a command line, or as part of a web page if you choose.

Some sample values:

XLIII = 43
MXXIX = 1029
MCMDXIV = 2414
Page last updated 4 October 2010