Example 1 — Look Up the Email Filter ID
Get the ID for the 'validate_email' filter and confirm it matches the FILTER_VALIDATE_EMAIL constant.
<?php
$id = filter_id('validate_email');
echo "Matches constant: ", $id === FILTER_VALIDATE_EMAIL ? "yes" : "no", PHP_EOL; How It Works
- filter_id('validate_email') looks up the number for that filter name.
- The result is stored in $id.
- FILTER_VALIDATE_EMAIL holds the very same number.
- The strict comparison with === prints yes.

