what is the syntax of the STRNCASECMP() function in php?
strncasecmp(string1,string2,length)
Parameter | Description |
---|---|
string1 | Required. Specifies the first string to compare |
string2 | Required. Specifies the second string to compare |
length | Required. Specify the number of characters from each string to be used in the comparison |
examples of the STRNCASECMP() function
Example 1. In this example, we compare two strings (case-insensitive).
<?php
echo strncasecmp("Hello world!","hello earth!",6);
?>
Example 2. In this example, we compare two strings (case-insensitive = Hello and hELLo will output the same).
<?php
echo strncasecmp("Hello","Hello",6);
echo "<br>";
echo strncasecmp("Hello","hELLo",6);
?>