diff --git a/INFO-1208 (PHP)/Labs/Lab 6/Screenshot 1.png b/INFO-1208 (PHP)/Labs/Lab 6/Screenshot 1.png new file mode 100644 index 0000000..32e6ae7 Binary files /dev/null and b/INFO-1208 (PHP)/Labs/Lab 6/Screenshot 1.png differ diff --git a/INFO-1208 (PHP)/Labs/Lab 6/Screenshot 2.png b/INFO-1208 (PHP)/Labs/Lab 6/Screenshot 2.png new file mode 100644 index 0000000..41b7078 Binary files /dev/null and b/INFO-1208 (PHP)/Labs/Lab 6/Screenshot 2.png differ diff --git a/INFO-1208 (PHP)/Labs/Lab 6/info1208-lab6-l_mclean215318.zip b/INFO-1208 (PHP)/Labs/Lab 6/info1208-lab6-l_mclean215318.zip new file mode 100644 index 0000000..0c4a7ef Binary files /dev/null and b/INFO-1208 (PHP)/Labs/Lab 6/info1208-lab6-l_mclean215318.zip differ diff --git a/INFO-1208 (PHP)/Labs/Lab 6/lab6.php b/INFO-1208 (PHP)/Labs/Lab 6/lab6.php new file mode 100644 index 0000000..be22b4e --- /dev/null +++ b/INFO-1208 (PHP)/Labs/Lab 6/lab6.php @@ -0,0 +1,90 @@ +"); +} else { + $userAge = $_POST["ageInput"]; + $birthYear = date("Y") - $userAge; + if ($userAge < 0) { + print("Please enter a valid age above or equal to 0"); + } else { + print("Your age is " . $userAge . "
"); + + // Two ways to determine even-ness + $isEven = ($userAge % 2 === 0) ? "Your age is even
" : "Your age is odd
"; + print($isEven); + + // OR + // if ($userAge % 2 === 0) { + // print("Your name is even
"); + // } else { + // print("Your name is odd
"); + // } + + // Print age "category" + if ($userAge <= 12) { + print("You are a child
"); + } else if ($userAge > 12 && $userAge <= 17) { + print("You are a teenager
"); + } else if ($userAge > 17 && $userAge <= 54) { + print("You are an adult
"); + } else { + print("You are a senior
"); + } + + // Print significant events with switch statement + switch ($birthYear) { + case 1969: + print("You were born the same year as the moon landing
"); + break; + case 1983: + print("You were born the same year as the creation of the internet
"); + break; + case 1986: + print("You were born the same year as the Challenger explosion
"); + break; + case 2000: + print("You were born the same year as Y2K
"); + break; + case 2020: + print("You were born the same year as the COVID-19 pandemic
"); + break; + default: + print("You were not born in any significant year
"); + break; + } + + // Print age number of hearts + for ($i = 0; $i < $userAge; $i++) { + print("♥"); + } + + print("
"); + + // Print 100 - age number of stars + for ($i = 0; $i < (100 - $userAge); $i++) { + print("☆"); + } + + print("
"); + } +} +?> + + + + + PHP Lab 6 + + + + +

Age Result Generator

+
+ +
+ +
+ + \ No newline at end of file