• PHP Video Tutorials

PHP - Function Strcoll



Syntax

int strcoll ( string $str1 , string $str2 )

Definition and Usage

It is used to compare two strings based on locale

Return Values

It returns the string functions

Parameters

Sr.No Parameters & Description
1

string1

It specifies the first string to compare

2

string2

It specifies the second string to compare

Example

Try out the following example

<?php
   echo "If this function returns 0, the two strings are equal.";
   echo "<br> The result is ";
   
   setlocale (LC_COLLATE, 'NL');
   echo strcoll("Hello World!","Hello World!");
?>

This will produce following result −

If this function returns 0, the two strings are equal.
The result is 0
php_function_reference.htm
Advertisements