PHP substr_compare() function
##Definition and usage
substr_compare() function compares two strings from the specified starting position.Tip: This function is binary safe and optionally case sensitive (case sensitive).
Grammar (Recommended learning: PHP video tutorial)
substr_compare(string1,string2,startpos,length,case)
Parameter description:
Boolean value specifying whether to perform case-sensitive comparisons:
FALSE - Default. Case sensitive TRUE - Not case sensitiveThis function returns:
<0 - if string1 (startpos) is less than string2>0 - if string1 (startpos) is greater than string2if length is greater than or equal to string1 length, the function returns FALSE.
Example:
<?php echo substr_compare("Hello world","Hello world",0); ?>
The above is the detailed content of Is substr_compare() case sensitive in php?. For more information, please follow other related articles on the PHP Chinese website!