String comparison function; comparison function; string comparison

php strncasecmp() function syntax

Function:Compare the first n characters of the string, case-insensitive

Syntax:strncasecmp(string1,string2,length)

Parameters:

Parameters Description
string1 Required. Specifies the first string to compare.
string2 Required. Specifies the second string to be compared.
length Required. Specifies the number of characters per string used for comparison.

Description:strncasecmp() function compares two strings. strncasecmp() is binary-safe and case-insensitive. If the two strings are equal, 0 is output. If string1 is greater than string2, the output value is greater than 0. If string1 is less than string2, the output value is less than 0.

php strncasecmp() function example


Run instance»

Click the "Run instance" button to view the online instance

Output:

0