Checking string size
We usually using strlen() function to check the string size. The fast way to checking string size is using isset().
if (strlen($str) <>
echo ‘String must be at least 5 chars’;
}
if (!isset($str{5})) {
echo ‘String must be at least 5 chars’;
}
isset() needs more little time than strlen() because isset() is construction language.
if (strlen($str) <>
echo ‘String must be at least 5 chars’;
}
if (!isset($str{5})) {
echo ‘String must be at least 5 chars’;
}
isset() needs more little time than strlen() because isset() is construction language.




0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home