Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi All,


Thanks for your immense help before.:) I have one question regarding the example shown in the book "PHP6 and MySQL5" I tried it according to what this book said. However, I saw this error message "Fatal error: Class 'Collator' not found in C:\xampp\htdocs\collation.php on line 22"


I am attaching the web page here. Please see below:




<?php header ('Content-Type: text/html; charset=UTF-8'); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Collation in PHP</title>


<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>';


echo implode('<br />', $words);


// Sort using the Collator:

echo '<h3>Using Collator</h3>';

$c = new Collator('fr_FR');


echo implode('<br />', $words);








Thank you in advance and look forward to hearing from you soon.

Link to comment
Share on other sites

You're welcome. As for this question, what version of PHP are you using? It's pretty important information, which is why the guidelines specifically recommend that you include it. In fact, if you want fast answers, I would recommend reviewing the guidelines, because there are lots of good suggestions there.

Link to comment
Share on other sites

Yeah, many of the things that I talk about in the book as being planned for PHP 6 ended up in PHP 5.3, in places like the SPL (Standard PHP Library). I'm trying to figure out how to introduce the SPL in the fourth edition of this book. The third edition of my PHP Advanced book will probably cover it in detail.

  • Upvote 1
Link to comment
Share on other sites

  • 1 year later...

Dear Larry,


I have chack above link but I can not understand howto use, When I run following example It will display error (Fatal error: Class 'Collator' not found in:)


$coll = collator_create( 'en_US' );

$arr = array( 'at', 'às', 'as' );


var_export( $arr );

collator_sort( $coll, $arr );

var_export( $arr );


So I am requesting to you kindly give me proper suggestion. I am using wamp. Its have following version :

Apache Version :2.2.21 PHP Version :5.3.8 MySQL Version :5.5.16

Version 2.English Version


Plz provide me some code so I can solve this problum as soon as possible.

Link to comment
Share on other sites


  • Create New...