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

  • Home
  • SEARCH
  • 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 8246125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:24:17+00:00 2026-06-07T22:24:17+00:00

In PHP to check non-equality (without checking type) you can do this: if( A

  • 0

In PHP to check non-equality (without checking type) you can do this:

if( A != B ) {
    DO SOMETHING;
}

But you can also do this, which has the same result:

if( A <> B ) {
    DO SOMETHING;
}

Is there any difference?

Does using != over <> change the evaluation in any way, shape, or form?

  • 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-07T22:24:19+00:00Added an answer on June 7, 2026 at 10:24 pm

    Forgetting documentation for a minute, let’s check out the source code. Let’s start with the scanner (lexer):

    <ST_IN_SCRIPTING>"!="|"<>" {
        return T_IS_NOT_EQUAL;
    }
    

    So they parse to the same token. Let’s check out the parser:

    expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
    

    So we know that the opcode that’s fired is ZEND_IS_NOT_EQUAL…

    Now, let’s check out the operation:

    static int ZEND_FASTCALL  ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
    {
        USE_OPLINE
    
        zval *result = &EX_T(opline->result.var).tmp_var;
    
        SAVE_OPLINE();
        ZVAL_BOOL(result, fast_not_equal_function(result,
            opline->op1.zv,
            opline->op2.zv TSRMLS_CC));
    
        CHECK_EXCEPTION();
        ZEND_VM_NEXT_OPCODE();
    }
    

    So there’s literally no difference. Since they parse to the same token, they have exactly the same precedence. Since they use the same executor, and there’s no decision point in the opcode routine, they execute identical code.

    So yes, <> and != are 100% interchangeable, and there’s absolutely no technical reason to use one over the other.

    With that said, there is something significant to gain by being consistent. So I’d recommend just sticking with != and being done with it…

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

Sidebar

Related Questions

I recently found out that PHP not only has the fsock* functions, but also
How can a PHP script check if a value is in an array? I
I have a php script that check if the referrer has been cleared after
Is their any way can I check in PHP that my brower(s) FF/Chrome/IE/Safari popup
I am attempting to create a php function which will check if the passes
I've been trying to create a non-flash upload panel which also shows a progress
in Frontend.php I replaced this: $this->add('BasicAuth') ->allow('demo','demo') // use check() and allowPage for white-list
I have the following PHP code // Check if the upload is setted if
Is there any function available in PHP to check whether an array is empty
I'm using curl in PHP to check the HTTP code when requesting some files,

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.