Jump to content
Larry Ullman's Book Forums

Recommended Posts

Pls after tring out the locale script in chapter 14. I encountered an error. Note am using wamp 2.2e which has php 5.4.3.

 

This is the code:

 

<?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>Locales</title>

</head>

<body style="font-size: 18pt;">

<?php # Script 14.5 - locales.php

 

// Set the default timezone:

date_default_timezone_set('UTC');

 

// Need a date object:

$d = new DateTime();

 

// Create a list of locales:

$locales = array('en_US', 'fr_FR', 'es_BO', 'zh_Hans_CN', 'ru_RU', 'el_GR', 'is_IS');

 

// Print the date in each locale:

foreach ($locales as $locale) {

 

// Set the locale:

locale_set_default($locale);

 

// Print the date:

echo "<p>$locale: " . strtotitle(date_format_locale($d, 'l, j F Y')) . "</p>\n";

 

}

 

?>

</body>

</html>

 

This is the error encountered:

 

( ! ) Fatal error: Call to undefined function locale_set_default() in C:\wamp\www\phpmyql3_scripts\ch14\locales.php on line 25 Call Stack

 

# Time Memory Function Location 1 0.0021 142912 {main}( ) ..\locales.php:0

 

Pls help. Thanks.

Link to comment
Share on other sites

Thank you so much larry. Can u please and I say pls again, tell me why in chapter 14 (making universal sites) script 14.2 and upwards don't seem to be running as u said it would in the book. When I run the codes with my php 5.4.3 I get the result u said one would get if he ws running on php 5.2 or less. I already created a topic on dis (unicode) but did nt really get much understanding from what ppl said.

Pls help me out have been stuck @ chpter 14 for the past one month now.

Can wait to see ur reply sire.

Thanks a lot.

Link to comment
Share on other sites

 Share

×
×
  • Create New...