Text
|
|
|
|
<?php
/*
This function tests to make sure a string is _really_ non-null. It
accepts one argument:
$string - the string to be tested
It returns true if the string is really a null string, and false
otherwise.
*/ function isBlank ($string) {
if ($string == "") return true;
for ($i = 0; $i < strlen($string); $i++) {
$c = substr($string, $i, 1);
if (($c != "r") && ($c != " ") && ($c != "n") && ($c != "t")) {
return false;
}
}
return true;
} ?>
|
|
|
Usage Example
|
$string = " n"
if (isBlank($string)) {
echo "Blank!n";
else {
echo "Validn";
}
/* Result:
Blank!
*/
|
|
|
Rate This Script
|
|
|
|