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 8045763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:38:17+00:00 2026-06-05T05:38:17+00:00

This is a question that is bugging me for a long time and can’t

  • 0

This is a question that is bugging me for a long time and can’t find any answer…
Noticed it’s used quite a lot by Zend Framework Developers,

What is the difference between following 2 “if” statements? :

if (null === $this->user) { ... }

if ($this->user === null) { ... }

To me the first one looks kinda odd ;]

Thanks for answer.

  • 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-05T05:38:18+00:00Added an answer on June 5, 2026 at 5:38 am

    This is not a difference for the way your script works, it’s just a coding standard, a recommendation

    The reason why it is recommended to use it this way:

    if (null == $this->user)
    

    is the fact that if you mistype and write = instead of == you will get an error, while

    ($this->user = null)
    

    instead of

    ($this->user == null)
    

    works but causes weird bugs (assignment and the final value is evaluated as bool instead of comparison)

    and I guess it just extended as a habit to the strict comparison operator (===)

    Update: since I see that there’s still some activity on this thread even 3 years after I posted the answer I figured I would add something I forgot to mention. This type of notation is known as yoda conditions, you can read more about it on this wikipedia page for example.

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

Sidebar

Related Questions

This question's been bugging me for a long time. I've always wondered how game
This is a question that's been bugging me for some time now: In photoshop/GIMP,
This is a dumb question that's been bugging me for a bit. Why can't
This is a question that has been bugging me for a while. I started
This is a question that has been bugging me for a while and I
This is a simple question that has been bugging me. In XCode 4.2, is
This is not a homework question, just something at work that's bugging me. I'm
This question was bugging me for quite a while (as evidenced by my previous
I've got this question that's been bugging me and my vast and unfathomable intellect
This question is bugging me over and over again and I cannot find a

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.