if ($user_id == NULL || $user_name == NULL || $user_logged == NULL) {
$user_id = '-1';
$user_name = NULL;
$user_logged = NULL;
}
if ($user_admin == NULL) {
$user_admin = NULL;
}
- Is there any shortest way to do it ?
- And if i right, it should be tested with
is_null? - It’s possible
$user_id,$user_nameand$user_loggedwrite in one line (maybe array?) without repeatingNULL?
If you want to test whether a variable is really
NULL, use the identity operator:If you want to check whether a variable is not set:
Or if the variable is not set or has an "empty" value (an empty string, zero, etc., see this page for the full list):
If you want to test whether an existing variable contains an empty string, then compare it with an empty string:
If you want to test whether an existing variable contains a value that’s considered "not empty" (non-empty string or array, non-zero number, etc..),
!will be sufficient: