Php Validation Tutorials

PHP FILTER VALIDATION

Filter The Special CharactersValidate Integer: FILTER_VALIDATE_INTValidate Integer With Range: FILTER_VALIDATE_INTValidate Email: FILTER_VALIDATE_EMAILValidate Email With _GET Method: FILTER_VALIDATE_EMAILValidate Integer With _POST Method: FILTER_VALIDATE_INTFilter The Special Characters <?php $String="asdf-32^3###3sa435r"; $String=preg_replace('/[^a-zA-Z0-9_ -]/s', '', $String); echo $String; /** output **/ asdf-3233sa435r ?> Validate Integer: FILTER_VALIDATE_INT <?php $int = "123"; if(!filter_var($int, FILTER_VALIDATE_INT)) { echo($int." Integer is not valid"); } else { echo($int." Integer is valid"); } ?> <!-- OUTPUT 123.1 Integer is not valid 123 […]... Read More »