Thursday, November 13, 2025
HomeLanguagesPHP | IntlCalendar getAvailableLocales() Function

PHP | IntlCalendar getAvailableLocales() Function

The IntlCalendar::getAvailableLocales() function is an inbuilt function in PHP which is used to display an array list of locales for which calendars are installed.

Syntax:

  • Object oriented style
    array IntlCalendar::getAvailableLocales( void )
  • Procedural style
    array intlcal_get_available_locales( void )

Parameters: This function does not accept any parameters.

Return Value: This function returns an array of strings which contains the locale value.

Below programs illustrate the IntlCalendar::getAvailableLocales() function in PHP:

Program 1:




<?php
  
// Use IntlCalendar::getAvailableLocales() function
// to get the locale list
var_dump(IntlCalendar::getAvailableLocales());
  
?>


Output:

array(683) {
  [0]=>
  string(2) "af"
  [1]=>
  string(5) "af_NA"
  [2]=>
  string(5) "af_ZA"
  [3]=>
  string(3) "agq"
  [4]=>
  string(6) "agq_CM"
  [5]=>
  string(2) "ak"
  ...
}

Program 2:




<?php
  
// Use intlcal_get_available_locales() function
// to get the list of locale
var_dump(intlcal_get_available_locales());
  
?>


Output:

array(683) {
  [0]=>
  string(2) "af"
  [1]=>
  string(5) "af_NA"
  [2]=>
  string(5) "af_ZA"
  [3]=>
  string(3) "agq"
  [4]=>
  string(6) "agq_CM"
  [5]=>
  string(2) "ak"
  ...
}

Reference: https://www.php.net/manual/en/intlcalendar.getavailablelocales.php

RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11916 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6839 POSTS0 COMMENTS