We have a comparison operator which has a operator '==='. Can someone guide, what is evaluated first, the "type" or the value equality?
The type check is first. It is not possible to compare variables of different types without first casting them both to the same type.
I think it is the type because ===does equalty without conversion but sometimes values are coded identically like "0" and "false". As 0 !== false I think the first thing tested is type.
According to source code :
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;
}
/*then value check*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With