why does this script produce two fatal errors?
<?php
$string = " ";
echo "str is '$string'\n";
echo "empty(str) is '".empty($string)."'\n";
echo "trim(str) is '".trim($string)."'\n";
echo "isset(trim(str)) is '".isset(trim($string))."'\n";
echo "empty(trim(str)) is '".empty(trim($string))."'\n";
?>
i get it. isset() and empty() must be fed variable names, not variables faces.
i guess php is as idealistic as i am. /o/
What are you talking about faces vs. names?
you have to use the name of a variable, not the face-value of it.
<?php
$str = "abc";
echo(empty($str)); // this will work.
echo(empty("$str")); // this will NOT work.
?>
empty("$str") passes a string to empty(), it is the same as empty('hello'), since empty() and isset() work on the variables themselves, and not on the values (i.e. strings), so it produces an error.
or: names, not faces. :D
ozntz
toooooooooooooooooooooooooooooooooo
You're passing a literal string rather than the variable (which in this case is by value, not reference). Nub