Checking String Length : strlen « String « PHP
- PHP
- String
- strlen
Checking String Length
<?php
define ("MAXLENGTH", 10);
if (strlen ("Hello World!") > MAXLENGTH){
echo "The field you have entered can only be " . MAXLENGTH . " characters in length.";
} else {
//Insert the field into the database.
}
?>
Related examples in the same category