Checking String Length: int strlen ( string string ) : strlen « String « PHP






Checking String Length: int strlen ( string string )

 
<?php 

define ("MAXLENGTH", 10); 
if (strlen ("Hello World!") > MAXLENGTH){ 
    echo "The field you have entered can be only " . MAXLENGTH . " characters in length."; 
} 
?>
  
  








Related examples in the same category

1.Calculating the length of a string
2.Checking String Length
3.Concisely checking the length of a trimmed string
4.strlen.php
5.int strlen ( string str ) returns the number of characters in it: