empty() may be used to check if a variable has not been declared or its value is false. This language construct is usually used to check if a form variable has not been sent or does not contain data. When checking a variable's truth value, its value is first converted to a Boolean according to the rules in the following section, and then it is checked for TRue/false.<span class="fullpost">
For example:
if (empty($name)) {
print 'Error: Forgot to specify a value for $name';
}This code prints an error message if $name doesn't contain a value that evaluates to true.</span>
Tidak ada komentar:
Posting Komentar