<HTML ><HEAD ><TITLE >setlocale</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="String functions" HREF="ref.strings.html"><LINK REL="PREVIOUS" TITLE="rtrim" HREF="function.rtrim.html"><LINK REL="NEXT" TITLE="sha1_file" HREF="function.sha1-file.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.rtrim.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.sha1-file.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.setlocale" ></A >setlocale</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN90506" ></A ><P > (PHP 3, PHP 4 )</P >setlocale -- Set locale information</DIV ><DIV CLASS="refsect1" ><A NAME="AEN90509" ></A ><H2 >Description</H2 >string <B CLASS="methodname" >setlocale</B > ( mixed category, string locale [, string ...])<BR ></BR >string <B CLASS="methodname" >setlocale</B > ( mixed category, array locale)<BR ></BR ><P > <TT CLASS="parameter" ><I >Category</I ></TT > is a named constant (or string) specifying the category of the functions affected by the locale setting: <P ></P ><UL ><LI ><P > LC_ALL for all of the below </P ></LI ><LI ><P > LC_COLLATE for string comparison, see <A HREF="function.strcoll.html" ><B CLASS="function" >strcoll()</B ></A > </P ></LI ><LI ><P > LC_CTYPE for character classification and conversion, for example <A HREF="function.strtoupper.html" ><B CLASS="function" >strtoupper()</B ></A > </P ></LI ><LI ><P > LC_MONETARY for <A HREF="function.localeconv.html" ><B CLASS="function" >localeconv()</B ></A > </P ></LI ><LI ><P > LC_NUMERIC for decimal separator (See also <A HREF="function.localeconv.html" ><B CLASS="function" >localeconv()</B ></A >) </P ></LI ><LI ><P > LC_TIME for date and time formatting with <A HREF="function.strftime.html" ><B CLASS="function" >strftime()</B ></A > </P ></LI ></UL > </P ><P > If <TT CLASS="parameter" ><I >locale</I ></TT > is the empty string <TT CLASS="literal" >""</TT >, the locale names will be set from the values of environment variables with the same names as the above categories, or from "LANG". </P ><P > If <TT CLASS="parameter" ><I >locale</I ></TT > is zero or <TT CLASS="literal" >"0"</TT >, the locale setting is not affected, only the current setting is returned. </P ><P > If <TT CLASS="parameter" ><I >locale</I ></TT > is an array or followed by additional parameters then each array element or parameter is tried to be set as new locale until success. This is usefull if a locale is known under different names on different systems or for providing a fallback for a possibly not available locale. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > Passing multiple locales is not available before PHP 4.3.0 </P ></BLOCKQUOTE ></DIV ><P > Setlocale returns the new current locale, or <TT CLASS="constant" ><B >FALSE</B ></TT > if the locale functionality is not implemented in the platform, the specified locale does not exist or the category name is invalid. An invalid category name also causes a warning message. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > The return value of <B CLASS="function" >setlocale()</B > depends on the system that PHP is running. It returns exactly what the system setlocale function returns. </P ></BLOCKQUOTE ></DIV ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN90568" ></A ><P ><B >Example 1. <B CLASS="function" >setlocale()</B > Examples</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?php /* Set locale to Dutch */ setlocale (LC_ALL, 'nl_NL'); /* Output: vrijdag 22 december 1978 */ echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 12, 22, 1978)); /* try different possible locale names for german as of PHP 4.3.0 */ $loc_de = setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'); echo "Preferred locale for german on this system is '$loc_de'"; ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.rtrim.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.sha1-file.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >rtrim</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.strings.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >sha1_file</TD ></TR ></TABLE ></DIV ></BODY ></HTML >