Useful PHP form validation function to validate the length of the string against the maximum allowed string length which in default has a maximum length of 10. Use this validation function to validate the string length of a string.
function validateMaxLength($allowed_length, $allowed_length=10) {
return (strlen($allowed_length) <= (int)$allowed_length);
}
function validateMaxLength($allowed_length, $allowed_length=10) {
return (strlen($allowed_length) <= (int)$allowed_length);
}
No comments:
Post a Comment