Return to Snippet

Revision: 17391
at September 2, 2009 20:09 by scopefragger


Initial Code
$varable = 'thisisatest';
echo strlen($varable); // 11

$varable = '1234567';
echo strlen($varable); // 7
?>


//Nof for an 'if' example
if(strlen($username)>8){$validate=='fail'}
else
{$validate=='pass'}

Initial URL
http://www.scopesden.co.uk/code_get_feed.php?Content_ref=14

Initial Description
Sometimes counting the length of a variable is a necessity, such as when a new user registers. You may restrict a limit of 10 characters as a username or password, Using the following php function you can count the length of a variable.

In additionally I have provided an example ‘If’ statement that could be used in a username length validation.

Initial Title
Count Varable character lengh

Initial Tags


Initial Language
PHP