Challenge 2 — Solution Task: Write a function validateRegistration($email, $age) that uses filter_var() to check both, returning an array of error messages (empty if everything is valid). Test it with one fully valid set of inputs and one fully invalid set. ["min_range" => 0, "max_range" => 130]])) { $errors[] = "Please enter a valid age."; } return $errors; } $validErrors = validateRegistration("sam@example.com", "28"); $invalidErrors = validateRegistration("not-an-email", "999"); echo "Valid input errors: " . count($validErrors) . "
"; print_r($invalidErrors); ?> Output: Valid input errors: 0 Array ( [0] => Please enter a valid email address. [1] => Please enter a valid age. ) Notes: - validateRegistration("sam@example.com", "28") returns an empty array because both filter_var() checks pass - a correctly-formatted email and an age within the 0-130 range. - validateRegistration("not-an-email", "999") fails both checks: the email has no @ symbol or valid domain shape, and 999 falls outside the max_range of 130, so both error messages end up in the returned array. - Returning an array of messages (rather than just true/false) lets the calling code display every problem at once, rather than only the first one found - genuinely more helpful for a real registration form where a visitor benefits from seeing all their mistakes together.