Skip to content

Commit 6063bcf

Browse files
authored
Document support for ISO 3166-1 numeric codes
To accompany PR symfony/symfony#51073
1 parent 76de54f commit 6063bcf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

components/intl.rst

Lines changed: 23 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

0 commit comments

Comments
 (0)