Skip to content

Commit 3cd5ded

Browse files
committed
Document support for ISO 3166-1 numeric codes
To accompany PR symfony/symfony#51073
1 parent 76de54f commit 3cd5ded

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

components/intl.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,29 @@ You may convert codes between two-letter alpha2 and three-letter alpha3 codes::
179179

180180
$alpha2Code = Countries::getAlpha2Code($alpha3Code);
181181

182+
Numeric Country Codes
183+
~~~~~~~~~~~~~~~~~~~~~
184+
185+
The :class:`Symfony\\Component\\Intl\\Countries` class also provides access to the
186+
numeric country codes according to the `ISO 3166-1 numeric`_ list::
187+
188+
use Symfony\Component\Intl\Countries;
189+
190+
\Locale::setDefault('en');
191+
192+
$numericCodes = Countries::getNumericCodes();
193+
// ('alpha2Code' => 'numericCode')
194+
// => ['AA' => '958', 'AD' => '020', ...]
195+
196+
$numericCode = Countries::getNumericCode('FR');
197+
// => '250'
198+
199+
$alpha2 = Countries::getAlpha2FromNumeric('250');
200+
// => 'FR'
201+
202+
$exists = Countries::numericCodeExists('250');
203+
// => true
204+
182205
Locales
183206
~~~~~~~
184207

@@ -435,6 +458,7 @@ Learn more
435458
.. _`Unicode ISO 15924 Registry`: https://www.unicode.org/iso15924/iso15924-codes.html
436459
.. _`ISO 3166-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
437460
.. _`ISO 3166-1 alpha-3`: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
461+
.. _`ISO 3166-1 numeric`: https://en.wikipedia.org/wiki/ISO_3166-1_numeric
438462
.. _`UTC/GMT time offsets`: https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
439463
.. _`daylight saving time (DST)`: https://en.wikipedia.org/wiki/Daylight_saving_time
440464
.. _`ISO 639-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_639-1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy