PHP strcoll() Function
In this chapter you will learn:
- Definition for PHP strcoll() Function
- Syntax for PHP strcoll() Function
- Parameter for PHP strcoll() Function
- Return for PHP strcoll() Function
- Note for PHP strcoll() Function
Definition
The strcoll() function compares two strings.
Syntax
PHP strcoll() Function has the following syntax.
strcoll(string1,string2)
Parameter
Parameter | IsRequired | Description |
---|---|---|
string1 | Required. | First string to compare |
string2 | Required. | 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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP strcspn() Function
- Syntax for PHP strcspn() Function
- Parameter for PHP strcspn() Function
- Return for PHP strcspn() Function
- Example - Print the number of characters found in "Hello world!" before the character "w"
- Example - Set the start and length to search
Home » PHP Tutorial » PHP String Functions