Inside your public_html
folder, last week you created a new folder called
cs1102
. Inside your new cs1102
folder, create another folder (a subdirectory), called lab11
(all lowercase). Do this week's work inside this lab11
folder.
Again there's nothing to submit this week but please do the exercises anyway.
Write a PHP script called farm.php
. (Use template.php
from last week to start you off.)
Run the program in the same way that you did last week.
Validate the XHTML that your script outputs. You have not finished this exercise until it validates!
These are the marks that Guy got in his Christmas class tests: CS1100 75; CS1101 64; CS1102 100; CS1105 3; MA1003 3.
In your lab11
folder, write a PHP script called guy.php
, as follows.
In case you don't know, the mean is the sum of Guy's marks divided by the number of marks. And the standard
deviation involves (a) calculating the difference between each mark and the mean, (b) squaring each difference, (c) summing up all
these squared differences, (d) dividing this total by the number of marks, and finally (e) taking the square root. (PHP has
a function called sqrt
for this last step.) Ask for help with means and standard deviations, if you need it.
(Check your script: Guy's mean is 49, and his standard deviation to two decimal places is 39.33.)
Validate the XHTML that your script outputs. You have not finished this exercise until it validates!
There is no need to write a stylesheet to prettify the table.
In your lab11
folder, write a PHP script called explode.php
, as follows.
$myURL
like so:"http://www.cs.ucc.ie/cs1/index.html"
strpos
and substr
to extract the following:
PHP has a built-in function (parse_url
) for doing all this
properly! Obviously, you should not use it in this exercise.