Bonjour a tous,

j'ecris le code suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php header ('Content-Type: text/html; charset=UTF-8'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Collation in PHP</title>
</head>
<body style="font-size: 18pt;">
<?php # Script 14.3 - collation.php
 
// Create an array of words:
$words = array('chère', 'côté', 'chaise', 'château', 'chaînette', 'châle', 'Chère', 'côte', 'chemise');
 
// Sort using the default PHP function:
echo '<h3>Using sort()</h3>';
sort($words);
echo implode('<br />', $words);
 
// Sort using the Collator:
echo '<h3>Using Collator</h3>';
$c = new Collator('fr_FR');
$words = $c->sort($words);
echo implode('<br />', $words);
 
?>
</body>
</html>
une fois que je le teste dans le navigateur, j'ai l'erreur et resultats suivants:
Using sort()
Chère
chaise
chaînette
chemise
châle
château
chère
côte
côté
Using Collator

Fatal error: Class 'Collator' not found in D:\wamp\www\PHP-TESTS\collation.php on line 22
Qu'ai je mal fait?
Je souhaiterais montionner que j'utilise PHP 5.2.8.

Merci d'avance