File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,33 @@ 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+
205+ .. versionadded :: 6.4
206+
207+ The support for numeric country codes was introduced in Symfony 6.4.
208+
182209Locales
183210~~~~~~~
184211
@@ -435,6 +462,7 @@ Learn more
435462.. _`Unicode ISO 15924 Registry` : https://www.unicode.org/iso15924/iso15924-codes.html
436463.. _`ISO 3166-1 alpha-2` : https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
437464.. _`ISO 3166-1 alpha-3` : https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
465+ .. _`ISO 3166-1 numeric` : https://en.wikipedia.org/wiki/ISO_3166-1_numeric
438466.. _`UTC/GMT time offsets` : https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
439467.. _`daylight saving time (DST)` : https://en.wikipedia.org/wiki/Daylight_saving_time
440468.. _`ISO 639-1 alpha-2` : https://en.wikipedia.org/wiki/ISO_639-1
You can’t perform that action at this time.
0 commit comments