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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:51:33+00:00 2026-06-17T12:51:33+00:00

Possible Duplicate: Reference – What does this symbol mean in PHP? I am trying

  • 0

Possible Duplicate:
Reference – What does this symbol mean in PHP?

I am trying to learn PHP and programming.
In the book I am studying there is something like:
$flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE;

$flags is used for the split() method.

The first flag is: If this flag is set, only non-empty pieces will be returned by preg_split().
The second is: If this flag is set, parenthesized expression in the delimiter pattern will be captured and returned as well.

Why isn’t he using && operator but the | ?

Can you please explain what | does actually?

As far as I know these are

  • 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-17T12:51:34+00:00Added an answer on June 17, 2026 at 12:51 pm

    && is the logical AND whereas | is a bitwise operator.

    a && b evalutes to true when both operands are evaluted to true. Since flags are almost always numbers greater than 1, this expression always evalutes to true.

    How functions accepting bitmasks work

    They specify constants

    Note that these constants have to have powers of 2:

    FLAG_INT1 = 1
    FLAG_INT2 = 2
    FLAG_INT3 = 4
    FLAG_INT4 = 8
    

    You call the function combining some flags

    myFunction(FLAG_INT1 | FLAG_INT3)
    

    This leads to a bitwise OR operation:

       0001
    OR 0100
    =======
       0101
    

    A set bit (1) in one (or both) of the operands will lead to a set bit (1) in the result, too.

    The function checks internally for each flag

    This requires a bitwise AND operation:

        0101
    AND 0001 // check for FLAG_INT1
    ========
        0001 // true
    
        0101
    AND 0010 // check for FLAG_INT2
    ========
        0000 // false
    
        0101
    AND 0100 // check for FLAG_INT3
    ========
        0100 // true
    

    The bitwise AND required both operands to have a set bit (1) at position X in order to result in a set bit (1) in the result at position X.

    Wikipedia has also a nice article about the common bitwise operators: http://en.wikipedia.org/wiki/Bitwise_operation

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

Sidebar

Related Questions

Possible Duplicate: Reference - What does this symbol mean in PHP? Is there any
Possible Duplicate: Reference - What does this symbol mean in PHP? I've been programming
Possible Duplicate: Reference - What does this symbol mean in PHP? I have a
Possible Duplicate: Reference - What does this symbol mean in PHP? What's the difference
Possible Duplicate: Reference - What does this symbol mean in PHP? I don't know
Possible Duplicate: Reference - What does this symbol mean in PHP? I am try
Possible Duplicate: Reference - What does this symbol mean in PHP? When I use
Possible Duplicate: Reference - What does this symbol mean in PHP? In PHP what
Possible Duplicate: Reference - What does this symbol mean in PHP? What does the
Possible Duplicate: Reference - What does this symbol mean in PHP? Consider this code

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.