Output Here is the output - 32 example Let's see another example - Now"/> Output Here is the output - 32 example Let's see another example - Now">
Home > Article > Backend Development > strcmp() function in PHP
strcmp() function is used to compare two strings.
Note - This function is case sensitive.
strcmp(str1, str2)
str1 - The first string to compare
str2 - The second string to compare
The strcmp() function returns -
0 - if the two strings are equal
>0 - If string1 is greater than string2
The following is an example-
Live demonstration
<?php echo strcmp("windows","Windows"); ?>
The following is the output -
32
Let’s see another example-
Live Demonstration
<?php echo strcmp("Windows OS","Windows Operating System"); ?>
Here is the output-
-7424
The above is the detailed content of strcmp() function in PHP. For more information, please follow other related articles on the PHP Chinese website!