$name = Input::getString('name'); echo "Hello, $name!";
$email = Input::getString('email'); if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "Thank you for subscribing!"; } else { echo "Please enter a valid email address."; }In this example, the Input package library is again used to retrieve a user input as a string. The user's email address is then validated using the built-in PHP filter_var function, which checks if the input is a valid email address. If the email address is valid, a confirmation message is printed to the screen. If it is not valid, an error message is printed instead.