Everything seems to be returning to this is_numeric_string_ex C function .
To start with the implementation of == :
ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) { ... switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { ... case TYPE_PAIR(IS_STRING, IS_STRING): ... ZVAL_LONG(result, zendi_smart_strcmp(op1, op2));
If both operands are zendi_smart_strcmp , it calls zendi_smart_strcmp ...
ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zval *s1, zval *s2) { ... if ((ret1 = is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && (ret2 = is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) ...
Which call is_numeric_string_ex ...
while (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r' || *str == '\v' || *str == '\f') { str++; length--; } ptr = str;
Whoever has explicit code for missing spaces at the beginning , but not at the end.
source share