Compare strings with locale information in PHP

Description

The following code shows how to compare strings with locale information.

Example


  /*from  w  w  w  .j ava2 s . c  om*/
<?php
    setlocale (LC_COLLATE, 'NL');
    echo strcoll("Hello World!","Hello World!");
    echo "<br>";
    
    setlocale (LC_COLLATE, 'en_US');
    echo strcoll("Hello World!","Hello World!");
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone