Home >Common Problem >What is the function of strcmp function?
The strcmp function compares the sizes of two strings and returns the comparison result.
The general form is:
i=strcmp(字符串,字符串);
Related recommendations: "FAQ"
Among them, both string 1 and string 2 are acceptable is a string constant or variable; i is an integer variable used to store the comparison result. The comparison result is specified as follows:
①If string 1 is less than string 2, the strcmp function returns a negative value;
②String 1 is equal to string 2, and the strcmp function returns zero;
③String 1 is greater than string 2, and the strcmp function returns a positive value.
The above is the detailed content of What is the function of strcmp function?. For more information, please follow other related articles on the PHP Chinese website!