Home > Article > Backend Development > strncasecmp() function in PHP
strncasecmp() function is used to compare two strings.
Note - This function is not case sensitive.
strncasecmp(str1,str2,len)
str1 − The first string to be compared
str2 − The second string to be compared
len − The length of the string used for comparison
strcoll() function returns -
0 - If two strings are equal
- if string1 is less than string2
> 0 − If string1 is greater than string2
The following is an example -
Live Demo
<?php echo strncasecmp("Demo text!","DEMO word!",4); ?>
0
The above is the detailed content of strncasecmp() function in PHP. For more information, please follow other related articles on the PHP Chinese website!