CS100 PHP Assignment

Your job is to write the file "php_assignment1.php", to accomplish the tasks described below. I have written my own version that you can play with. PHP is a server-side language, so you can use my program without being able to see my PHP code--I guess you'll just have to write your own.

Several of the descriptions below have hints that refer to PHP functions. You can view the reference information for those functions at http://www.php.net/.


Enter two numbers and select an operation:

When you click on Go, you will see the results of the selected computation.


Enter your full name:

Enter a number:

When you click on Go, you will see your middle name (assuming you have exactly three names) and a greeting printed as many times as the number you entered.


Enter a bland sentence or two:

When you click on Go, you will see your sentences with each period replaced by two exclamation points. (Hint: see the function str_replace.)


Enter a domain name (such as blum.mathcs.carleton.edu, www.apple.com, etc.):

When you click on Go, you will see the IP address corresponding to the domain name. (Hint: try the function gethostbyname).


10% extra credit

Enter an URL (you must include the http:// at the beginning):

When you click on Go, you will see the title of the given web page (the stuff that appears between <title> and </title>). This one is quite a bit harder than the others, and will require you to use file functions and string functions.