PHP Tutorial - PHP strcoll() Function






Definition

The strcoll() function compares two strings.

Syntax

PHP strcoll() Function has the following syntax.

strcoll(string1,string2)

Parameter

ParameterIsRequired Description
string1Required. First string to compare
string2Required. Second string to compare

Return

This function returns:

  • 0 - if the two strings are equal
  • <0 - if string1 is less than string2
  • >0 - if string1 is greater than string2




Note

The comparison of the strings may vary depending on the locale settings (A<a or A>a).

The strcoll() is case-sensitive but not binary-safe.