Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:14:32+00:00 2026-06-14T19:14:32+00:00

I have checked many questions on same topic on stack overflow but still I

  • 0

I have checked many questions on same topic on stack overflow but still I am not able to do it. Please excuse if I am missing something very trivial.

What I need to check is …whether a variable does not contain empty(or multiple whitespaces) string ?

but when I use like $a==NULL, it will fail for 0 which is a valid string.

when I use is_null() or $a===NULL, then it will only check for "" but not if user input contain multiple white space characters like " ".

I guess may be some kind of regular expression may help here but I am not sure. Please help me.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:14:33+00:00Added an answer on June 14, 2026 at 7:14 pm

    Use trim to remove whitespace characters:

    if (trim($my_str) === "") {
        // do things
    }
    

    Remember to use the identical comparison operator whenever possible to avoid truthiness issues (such as "0" acting as a false value).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have checked many question based on this but still I am not able
I have checked many questions here but none has my answer. I appreciate if
I have already checked many questions in StackOverflow but none of them worked for
I know that there have been many similar questions on this topic but none
I have checked many of other questions involving issues like this, but none have
I have checked this similar question, but the suggestions did not solve my problem:
I have checked many questions and answers regarding how to stop any browser at
I have read many questions considering thread-safe double checked locking (for singletons or lazy
Checked with so many asked questions about this but nothing has worked for my
We have many projects with several files inside each. Files can be checked in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.