Friday 9 September 2016

PHP Function to Validate String Length

Simple php function to validate the maximum length of a given string. Use this function to test if a given string's length is within the allowed limit. Validate maximum length of a string in php.

function validateMaxlength($string, $max_len) {
    return (strlen($string) <= (int)$max_len);
}



No comments:

Post a Comment