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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:24:25+00:00 2026-06-13T22:24:25+00:00

We have a comparison operator which has a operator ‘===’. Can someone guide, what

  • 0

We have a comparison operator which has a operator ‘===’. Can someone guide, what is evaluated first, the “type” or the value equality?

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

    Sure it’s the Type,
    normally when you use the == operator ,

    1. it will check the type first, if they are different it will convert one of them to be identical,
    2. then it will check if the values are equals,

    so always the Type will be evaluated first.

    EDIT

    Referring to artragis answer
    below is the full source code of the is_identical_function php 5.4.8 ( thanks to artragis )

    ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
        {
            Z_TYPE_P(result) = IS_BOOL;
            if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
                Z_LVAL_P(result) = 0;
                return SUCCESS;
            }
            switch (Z_TYPE_P(op1)) { // here it will check the Type and below it will check the value
                case IS_NULL:
                    Z_LVAL_P(result) = 1;
                    break;
                case IS_BOOL:
                case IS_LONG:
                case IS_RESOURCE:
                    Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
                    break;
                case IS_DOUBLE:
                    Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
                    break;
                case IS_STRING:
                    Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
                        && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
                    break;
                case IS_ARRAY:
                    Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
                        zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0);
                    break;
                case IS_OBJECT:
                    if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) {
                        Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2));
                    } else {
                        Z_LVAL_P(result) = 0;
                    }
                    break;
                default:
                    Z_LVAL_P(result) = 0;
                    return FAILURE;
            }
            return SUCCESS;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class for which I have defined comparison operator. Following is the
I have to do a comparison and I want to know which will be
I Have this error message : Possible unitended reference comparison; to get a value
Possible Duplicates: Types for which “is” keyword may be equivalent to equality operator in
I have a class called myClass, which returns cv::Scalar type, and I want to
I have a struct which has a unique key. I want to insert instances
I have a class which I use to record a value in a given
Could someone point out the idea of overloading operator== to perform deep object comparison
I have been using Application.Caller in a comparison in my code. When a user
I have a performance problem related to string comparison (in Java). I'm working on

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.