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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:50:53+00:00 2026-05-23T06:50:53+00:00

PHP manual doesn’t say that there is one, but… maybe there’s a hidden one?

  • 0

PHP manual doesn’t say that there is one, but… maybe there’s a hidden one?

Simply, I like using if‘s with symbolic operation representations, that way I’m sure that when searching through a document, I’ll always find what I’m looking for. But with xor there’s possibility that my code contains such a string/value or something. Like, method in template class – exorcize();.

  • 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-23T06:50:54+00:00Added an answer on May 23, 2026 at 6:50 am

    You could use != if they’re both already booleans.

    if (true != false) // xor
        ...
    

    Of course, this has the same issue with getting false positives in your search results, so perhaps you can adopt a personal convention (at the risk of confusing your co-workers) of using the other PHP not-equal operator:

    if (true <> false) // xor
        ...
    

    If they’re not already booleans, you’ll need to cast them.

    if (!$a <> !$b) // xor
        ...
    

    Edit: After some experimentation with PHP’s very lax type coercion, I give you a pseudo-operator of own creation, the ==! operator! $a ==! $b is equivalent to $a xor $b.

    if ('hello' ==! 0) // equivalent to ('hello' xor 0)
        ...
    

    This is actually 'hello' == !0 > 'hello' == true > true == true > true, which is why it works as xor. This works because when PHP compares one boolean with anything else, it converts the second argument to boolean too.

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

Sidebar

Related Questions

I really like the PHP function strtotime(), but the user manual doesn't give a
Is there a .dll version of the inclued extension for PHP ? The manual's
I'm using PHP for file uploads. In the PHP manual it shows an example
What does the following code do? A link to something in the PHP manual
In the PHP manual, to show the syntax for functions with optional parameters, they
According to the PHP manual , in order to make code more portable, they
In the PHP manual, the file operations reference an optional context (e.g. for copy
I'm looking at the PHP Manual , and I'm not seeing a section on
Or: Should I optimize my string-operations in PHP? I tried to ask PHP's manual
I just read about unset variable through php manual. The php manual says unset()

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.