Definition
The strncmp() function compares(binary-safe and case-sensitive) two strings.
Syntax
strncmp(string1, string2, length)
Parameters
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. |
Example
<?php
echo strncmp("Welcome to PHP!", "welcome to Php!", 4);