PHP strncmp() Function

PHP strncasecmp() Function
PHP strpbrk() Function

what is the syntax of the STRNCMP() function in php?

strncmp(string1,string2,length)
ParameterDescription
string1Required. Specifies the first string to compare
string2Required. Specifies the second string to compare
lengthRequired. Specify the number of characters from each string to be used in the comparison
PHP STRNCMP() method

examples of the STRNCMP() function

Example 1. In this example, we compare two strings (case-sensitive).

<?php
echo strncmp("Hello world!","Hello earth!",6);
?>

Example 1. In this example, we compare two strings (case-sensitive = Hello and hELLo will not output the same).

<?php
echo strncmp("Hello","Hello",6);
echo "<br>";
echo strncmp("Hello","hELLo",6);
?>
PHP strncasecmp() Function
PHP strpbrk() Function
en English
X
Scroll to Top