How to use strcoll in PHP

In this article I will explain how strcoll function used in PHP.
  • 1306

strcoll () Function

This function compares two strings

and give output:

  1. 0 - if the two strings are equal
  2. <0 - if string1 is less than string2
  3. >0 - if string1 is greater than string2

Note- It is a case-sensitive.

Syntax

strcoll(string1,string2)

 

 Parameter  Description
 string1  first string to compare
 string2  second string to compare

Example

<html>
<body>
<?php
setlocale (LC_COLLATE, 'NL');
echo strcoll("Hello India!","Hello India!");
echo "<br />";

setlocale (LC_COLLATE, 'en_US');
echo strcoll("Hello India!","Hello India!");
?>
</html>
</body>
 

 

Output


strcoll-php.jpg

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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.