//echo "<br>"; $x = rand(0, count($wins) - 1); $y = $wins[$x]; //echo $y; //echo "<br>"; $z = $prizes[$i]; echo $y . " has won all the " . $z; echo "<br>"; unset($wins[$x]); } echo "<br>"; function squareValue($number) { echo $number * $number; } squareValue(6); echo "<br>"; // activity vii function cleanUp($personName, $specsNum, $mugsNum, $sausageNum) { echo "Wanted: " . $personName; echo "<br>"; echo "Knwon to be in possession of the following items:"; echo "<br>"; echo "Specs (" . $specsNum . ")"; echo "<br>"; echo "Mugs (" . $mugsNum . ")"; echo "<br>"; echo "Sausage Rolls (" . $sausageNum . ")"; echo "<br>"; $x = $sausageNum * $mugsNum * $sausageNum;
echo "<br/>/*--------- FUNCTIONS -------------- */<br/>"; // get the length of a string and // print it to the screen $length = strlen("david"); print strtoupper("david") . " has exactly " . $length . " characters"; echo "<br/>"; // Round pi down from 3.1416... $round = round(M_PI); print "rounding PIto 0 decimals: " . $round; // prints 3 echo "<br/>"; // This time, round pi to 4 places $round_decimal = round(M_PI, 4); print "rounding PI to 4 decimals: " . $round_decimal; // prints 3.1416 echo "<br/>"; // prints a number between 0 and 32767 print "random numb btw 0-32767: " . rand(); echo "<br/>"; // prints a number between 1 and 10 print "random numb btw 1-10: " . rand(1, 10); echo "<br/>"; //invoke function $n = 6; echo squareValue($n); // echos 36 ?> </body> </html>
print "<br/>"; $winner = rand(0, count($people)); print "And the person who wins all the mugs iiiiiissssss *drums playing in the background* " . strtoupper($people[$winner]) . "!!!"; unset($people[$winner]); print "<br/>"; $winner = rand(0, count($people)); print "And the person who wins all the sausage rolls iiiiiissssss *drums playing in the background* " . strtoupper($people[$winner]) . "!!!"; print "<br/>"; print "<br/>"; print "<br/>"; function squareValue($number) { echo $number * $number; } $n = 6; squareValue($n); print "<br/>"; function cleanUp($name, $num_specs, $num_mugs, $num_sausages) { echo "Wanted: " . "<b>" . $name . "</b>" . "<br/>" . "Known to be in possession of the following items:" . "<br/>" . "Specs " . $num_specs . "<br/>" . "Mugs " . $num_mugs . "<br/>" . "Sausage Rolls " . $num_sausages . "<br/>" . "Award for capture: " . 5 * ($num_specs * $num_mugs * $num_sausages * ($num_specs * $num_mugs * $num_sausages)); } print "<br/>"; cleanUp("Vasilis", 3, 4, 5); print "<br/>"; print "<br/>"; cleanUp("Viky", 2, 1, 1); print "<br/>"; print "<br/>"; cleanUp("John", 1, 0, 3); ?> </p>