php-doc-en/reference/intl/locale/parse-locale.xml
Máté Kocsis 6fcf444471
Generate ext/intl methodsynopses based on stubs (Locale)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-910.
2021-09-05 14:58:44 +02:00

133 lines
3.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="locale.parselocale" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Locale::parseLocale</refname>
<refname>locale_parse</refname>
<refpurpose>Returns a key-value array of locale ID subtag elements</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis role="oop">
<modifier>public</modifier> <modifier>static</modifier> <type class="union"><type>array</type><type>null</type></type><methodname>Locale::parseLocale</methodname>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis role="procedural">
<type class="union"><type>array</type><type>null</type></type><methodname>locale_parse</methodname>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
</methodsynopsis>
<para>
Returns a key-value array of locale ID subtag elements.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>locale</parameter></term>
<listitem>
<para>
The locale to extract the subtag array from. Note: The 'variant' and
'private' subtags can take maximum 15 values whereas 'extlang' can take
maximum 3 values.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array containing a list of key-value pairs, where the keys
identify the particular locale ID subtags, and the values are the
associated subtag values. The array will be ordered as the locale id
subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the
returned array will have variant0=&gt;varX , variant1=&gt;varY ,
variant2=&gt;varZ
</para>
<para>
Returns &null; when the length of <parameter>locale</parameter> exceeds
<constant>INTL_MAX_LOCALE_LEN</constant>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>locale_parse</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = locale_parse('sl-Latn-IT-nedis');
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
?>
]]>
</programlisting>
</example>
<example>
<title>OO example</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = Locale::parseLocale('sl-Latn-IT-nedis');
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
?>
]]>
</programlisting>
</example>
&example.outputs;
<screen>
<![CDATA[
language : sl , script : Latn , region : IT , variant0 : NEDIS ,
]]>
</screen>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>locale_compose</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->