PHP strncasecmp() Function
The strncasecmp()
function is used to compare two given string. It is binary safe and case-insensitive.This is similar to the strncasecmp() function.
Syntax
strncasecmp(string1,string2,length)
- String1 - (Required) Specify the First string to compare.
- String2 - (Required) Specify the second string to compare.
- length - (Required) Specify the length of string to be used the comparision.
Example
<?php echo strncasecmp("Good Morning!","Good!",4); ?>
Output
0
Example
<?php echo strncasecmp("Good","GOOD",4); echo "<br>"; echo strncasecmp("GOOd","gOOD",4); ?>
Output
0