How to use strncmp in PHP
In this article I will explain how strncmp function used in PHP.
strncmp() Function
This function compares two strings.
and returns:
- 0 - if the two strings are equal
- <0 - if string1 is less than string2
- >0 - if string1 is greater than string2
Note- It is a case-sensitive.
Syntax
strncmp(string1,string2,length) |
Example
<html>
<body>
<?php
echo strncmp("Swati Sharma","sachin bhardwaj",6);
?>
</body>
</html> |
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here