Kod PHP, aby sprawdzić, czy zmienna jest null
if(empty($var1)){
echo 'This line is printed, because the $var1 is empty.';
}
Yellowed Yak
if(empty($var1)){
echo 'This line is printed, because the $var1 is empty.';
}
if (empty($var)) {
echo '$var is either 0, empty, or not set at all';
}
## CHECKS IF FILE IS EMPTY
if ($_FILES['file']['size'] == 0 && $_FILES['file']['error'] == 0)
{
// file is empty (and not an error)
}
empty($var):bool
//checks if the variable is empty and returns true or false