<?php if (!preg_match(‘~^[a-z0-9]*[0-9][a-z0-9]*$~i’,$password)) { // $subject is alphanumeric and contains at least 1 number $passworderror=”Please enter password with digits”; } ?>
Tag Archives: Php Validation
Filter The Special Characters Validate Integer: FILTER_VALIDATE_INT Validate Integer With Range: FILTER_VALIDATE_INT Validate Email: FILTER_VALIDATE_EMAIL Validate Email With _GET Method: FILTER_VALIDATE_EMAIL Validate Integer With _POST Method: FILTER_VALIDATE_INT Filter 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)) { […]