We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the strcmp() doc it says:
8.2.0 This function now returns -1 or 1, where it previously returned a negative or positive number.
However I the following code:
<?php echo strcmp("3", "1")."\n";
Resulted in this output:
2
But I expected this output instead:
1
The same problem exists for strncmp() and strncasecmp().
A fix is to change this line in zend_binary_strcmp() and zend_binary_strncmp() in zend_operators.c:
return retval;
to
return retval<0?-1:1;
PHP 8.4.1
Debian bookworm
The text was updated successfully, but these errors were encountered:
That's a doc bug, see php/doc-en#3629.
Sorry, something went wrong.
No branches or pull requests
Description
In the strcmp() doc it says:
However I the following code:
Resulted in this output:
But I expected this output instead:
The same problem exists for strncmp() and strncasecmp().
A fix is to change this line in zend_binary_strcmp() and zend_binary_strncmp() in zend_operators.c:
return retval;
to
return retval<0?-1:1;
PHP Version
PHP 8.4.1
Operating System
Debian bookworm
The text was updated successfully, but these errors were encountered: