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"

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

$c->sort($words);

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

 

?>

</body>

</html>

 

---------------------------------------------------------------------------------------------------------------------------------------------

 

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,

(http://us3.php.net/collator).

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:)

<?php

$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

 Share

×
×
  • Create New...