check if variable empty

0 votes
Code:
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;
}
  1. Is there any shortest way to do it?
  2. And if I am right, it should be tested with is_null?
  3. Is It possible $user_id, $user_name and $user_logged to write in one line (maybe array?) without repeating NULL?
Jun 4, 2022 in PHP by Kichu
• 19,040 points

edited 4 days ago 9 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP