PHP - Function timezone_identifiers_list()


Advertisements


Syntax

array timezone_identifiers_list ( void )

array DateTimeZone::listIdentifiers ( void )

Definition and Usage

These functions return numerically index array with all timezone identifiers.

The above two functions are equivalent and any of the functions can be used as shown below in the example.

Parameters

Parameter Description
void NA

Return Value

Returns array on success or FALSE on failure.

Example

Following is the usage of this function −

<?php
   $timezone_identifiers = DateTimeZone::listIdentifiers();
   for ($i=0; $i < 5; $i++) {
      echo "$timezone_identifiers[$i]\n";
   }
   
   echo "-------------------------------------------------\n";
   $timezone_identifiers = timezone_identifiers_list();
   
   for ($i=0; $i < 5; $i++) {
      echo "$timezone_identifiers[$i]\n";
   }
?>

This will produce the following result −

Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
-------------------------------------------------
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara

php_function_reference.htm

Advertisements