Compare two strings (case-sensitive):
The strcmp() function compares two strings.
Note: The strcmp() function is binary-safe and case-sensitive.
Tip: This function is similar to the strncmp() function, with the difference that you can specify the number of characters from each string to be used in the comparison with strncmp().
| Parameter | Description |
|---|---|
| string1 | Required. Specifies the first string to compare |
| string2 | Required. Specifies the second string to compare |
| Return Value: | This function returns:
|
|---|---|
| PHP Version: | 4+ |
Compare two strings (case-sensitive = Hello and hELLo will not output the same):
Different return values:
Complete PHP String Reference
Your message has been sent to W3Schools.