I've been working on a PHP project and came across a situation where I need to ensure the data type or format of the variables I'm working with. I'm wondering if there's a way to perform type checking or validation on variables in PHP.
To provide some context, I'm building a form where users can input various data such as names, ages, emails, and so on. I want to make sure that the data entered by the users is in the expected format. For example, I want to check if the age field contains only numeric values and the email field contains a valid email address.
Is there any built-in functionality in PHP that allows me to easily perform type checking or validation on variables? If so, could you please guide me on how to use it?
Thanks in advance!