- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
strcoll() function in PHP
The strcoll() function is used to compare two strings based on locale.
Note − This function is case-sensitive
Syntax
strcoll(str1, str2)
Parameters
str1 − First string to compare
str2 − Second string to compare
Return
The strcoll() function returns −
0 − if the two strings are equal
< 0 − if string1 is less than string2
> 0 − if string1 is greater than string2
Example
The following is an example −
<?php setlocale (LC_COLLATE, 'en_US'); echo strcoll("Demo text!","Demo text!"); ?>
Output
0
Example
The following is an example −
<?php $x = 'a'; $y = 'A'; setlocale (LC_COLLATE, 'de_CH'); print "de_CH: " . strcoll ($x, $y) . "
"; ?>
Output
de_CH: 32
- Related Articles
- What is strcoll() Function in C language?
- strcoll() in C/C++
- strcmp() function in PHP
- strcspn() function in PHP
- strip_tags() function in PHP
- stripcslashes() function in PHP
- stripos() function in PHP()
- stristr() function in PHP
- stripslashes() function in PHP
- strlen() function in PHP
- strnatcasecmp() function in PHP
- strnatcmp() function in PHP
- strncasecmp() function in PHP
- strncmp() function in PHP
- strpbrk() function in PHP

Advertisements