PHPのtimezone_abbreviations_list()関数
timezone_abbreviations_list()関数は、dst、offset、およびタイムゾーン名を含む連想配列を返します
構文
timezone_abbreviations_list()
パラメータ
-
NA
戻る
timezone_abbreviations_list()関数は、成功した場合は配列を返し、失敗した場合はFALSEを返します。
例
以下は例です-
<?php $timezone_abbreviations = timezone_abbreviations_list (); print_r($timezone_abbreviations["acst"]); echo "----------------------------------------------\n"; # Using second function. $timezone_abbreviations = DateTimeZone::listAbbreviations(); print_r($timezone_abbreviations["acst"]); ?>
出力
Array ( [0] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => America/Porto_Acre ) [1] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Adelaide ) [2] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Adelaide ) [3] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => America/Eirunepe ) [4] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => America/Rio_Branco ) [5] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => Brazil/Acre ) [6] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Broken_Hill ) [7] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Darwin ) [8] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/North ) [9] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/South ) [10] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Yancowinna ) [11] => Array ( [dst] => [offset] => 34200 [timezone_id] => Asia/Jayapura ) [12] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Broken_Hill ) [13] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Darwin ) [14] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/North ) [15] => Array( [dst] => [offset] => 34200 [timezone_id] => Australia/South ) [16] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Yancowinna ) ) ---------------------------------------------- Array ( [0] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => America/Porto_Acre ) [1] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Adelaide ) [2] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Adelaide ) [3] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => America/Eirunepe ) [4] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => America/Rio_Branco ) [5] => Array ( [dst] => 1 [offset] => -14400 [timezone_id] => Brazil/Acre ) [6] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Broken_Hill ) [7] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Darwin ) [8] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/North ) [9] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/South ) [10] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Yancowinna ) [11] => Array ( [dst] => [offset] => 34200 [timezone_id] => Asia/Jayapura ) [12] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Broken_Hill ) [13] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Darwin ) [14] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/North ) [15] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/South ) [16] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Yancowinna ) )
別の例を見てみましょう-
例
<?php $res = timezone_abbreviations_list(); print_r($res["act"]); ?>
出力
Array ( [0] => Array ( [dst] => [offset] => -18000 [timezone_id] => America/Porto_Acre ) [1] => Array ( [dst] => [offset] => -18000 [timezone_id] => America/Eirunepe ) [2] => Array ( [dst] => [offset] => -18000 [timezone_id] => America/Rio_Branco ) [3] => Array ( [dst] => [offset] => -18000 [timezone_id] => Brazil/Acre ) )
-
PHPのarray_rand()関数
array_rand()関数は、配列から1つ以上のランダムキーを返します。 構文 array_rand(arr, count) パラメータ 到着 −指定された配列 カウント −返すランダムキーの数 戻る array_rand()関数はランダムキーを返します。ランダムキーの配列(複数のキー)を返すかどうかを指定できます。 例 以下は例です- <?php $arr = array("p"=>"mobile","q"=>"laptop","r"=>"
-
PHPのarray()関数
PHPのarray()関数は配列を作成します。 PHPでは配列には3つのタイプがあります。 インデックス付き配列- 数値インデックス付きの配列です 連想配列- 名前付きキーを持つ配列です 多次元配列- 1つ以上のアレイを持つアレイです 構文 // array with numeric index i.e. Indexed arrays array(value1,value2...); // array with named keys i.e. associative arrays array(key1 => value1, key2 => value2...