What are the potential pitfalls of using eregi function to validate email addresses in PHP?
Using the eregi function to validate email addresses in PHP is not recommended as it is deprecated and may lead to security vulnerabilities. It is better to use the filter_var function with the FILTER_VALIDATE_EMAIL filter to validate email addresses in a more secure and reliable way.
$email = "example@example.com";
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo "Valid email address";
} else {
echo "Invalid email address";
}