Skip to content

Commit 9ff8b11

Browse files
authored
document setlocale(LC_ALL, null) to retrieve current setting (#4765)
1 parent c81a48e commit 9ff8b11

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

reference/strings/functions/setlocale.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<methodsynopsis>
1212
<type class="union"><type>string</type><type>false</type></type><methodname>setlocale</methodname>
1313
<methodparam><type>int</type><parameter>category</parameter></methodparam>
14-
<methodparam><type>string</type><parameter>locales</parameter></methodparam>
14+
<methodparam><type class="union"><type>string</type><type>null</type></type><parameter>locales</parameter></methodparam>
1515
<methodparam rep="repeat"><type>string</type><parameter>rest</parameter></methodparam>
1616
</methodsynopsis>
1717
<simpara>Alternative signature (not supported with named arguments):</simpara>
@@ -102,7 +102,7 @@
102102
categories, or from "LANG".
103103
</para>
104104
<para>
105-
If <parameter>locales</parameter> is <literal>"0"</literal>,
105+
If <parameter>locales</parameter> is &null;,
106106
the locale setting is not affected, only the current setting is returned.
107107
</para>
108108
<para>
@@ -184,6 +184,21 @@ echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));
184184
$loc_de = setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
185185
echo "Preferred locale for german on this system is '$loc_de'";
186186
?>
187+
]]>
188+
</programlisting>
189+
</example>
190+
</para>
191+
<para>
192+
<example>
193+
<title><function>setlocale</function> Retrieve current setting</title>
194+
<programlisting role="php" annotations="non-interactive">
195+
<![CDATA[
196+
<?php
197+
/* Retrieve current setting */
198+
$current = setlocale(LC_ALL, null);
199+
200+
echo "Current locale '$current'";
201+
?>
187202
]]>
188203
</programlisting>
189204
</example>

0 commit comments

Comments
 (0)