Home >Backend Development >PHP Tutorial >PHP function strcmp function example tutorial_PHP tutorial
Definition and usage
The strcmp() function compares two strings.
This function returns:
0 - if the two strings are equal
"0 - if string is less than string
"0 - if string is greater than string
Grammar
strcmp(string1,string2)
|
Description | ||||||
---|---|---|---|---|---|---|---|
string1 | Required. Compares the first specified string | ||||||
string2 | Required. Specify a second string comparison |
Tips and Instructions NOTE: The strcmp() function is binary safe and case sensitive. For example
<!--?phpecho strcmp("Hello world!","Hello world!");?-->
结果:0