Checking the length of a trimmed string
<? $zipcode = trim("12344"); $zip_length = strlen($zipcode); if ($zip_length != 5) { print "Please enter a ZIP code that is 5 characters long."; } ?>