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

The Archive Base Latest Questions

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

I have a codebase where developers decided to use AND and OR instead of

  • 0

I have a codebase where developers decided to use AND and OR instead of && and ||.

I know that there is a difference in operators’ precedence (&& goes before and), but with the given framework (PrestaShop to be precise) it is clearly not a reason.

Which version are you using? Is and more readable than &&? Or is there no difference?

  • 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-05-14T19:32:06+00:00Added an answer on May 14, 2026 at 7:32 pm

    If you use AND and OR, you’ll eventually get tripped up by something like this:

    $this_one = true;
    $that = false;
    
    $truthiness = $this_one and $that;
    

    Want to guess what $truthiness equals?

    If you said false… bzzzt, sorry, wrong!

    $truthiness above has the value true. Why? = has a higher precedence than and. The addition of parentheses to show the implicit order makes this clearer:

    ($truthiness = $this_one) and $that
    

    If you used && instead of and in the first code example, it would work as expected and be false.

    As discussed in the comments below, this also works to get the correct value, as parentheses have higher precedence than =:

    $truthiness = ($this_one and $that)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large codebase that targetted Flash 7, with a lot of AS2
I have seen a codebase recently that I fear is violating alignment constraints. I've
I have a fairly large codebase that depends on MooTools v1.11 and am about
I have a very large codebase (read: thousands of modules) that has code shared
I have a fairly large PHP codebase (10k files) that I work with using
I have an existing codebase targeting a Windows environment and with an eye to
I have an old Delphi codebase I have to maintain, lots of DLLs, some
I have a large codebase, and I'd like to refactor the package structure so
At the team with which I work, we have an old codebase using PHP's
As you work in a legacy codebase what will have the greatest impact over

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.