1. Go to this page and download the library: Download suadhuskic/bench library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
suadhuskic / bench example snippets
Bench\Bench;
//get all the countries in the united states.
//A two-letter ISO 3166-1 compatible country code,
//the time to use when starting the instance. Carbon\Carbon will be used.
//true/false - do you want unique offsets per country.
$us_time_zones = Bench::getTimezones('US', 'now', true);
foreach($us_time_zones as $tz) {
echo $tz->getName()."\n";
echo $tz->getShortAbbr()."\n";
echo $tz->getLongAbbr()."\n";
echo $tz->getOffset()."\n";
echo $tz."\n";
echo "----------------------------\n";
}
// America/Adak
// HDT
// Hawaii-Aleutian Daylight Time
// -09:00
// (GMT -09:00) Hawaii-Aleutian Daylight Time
// ----------------------------
// America/Anchorage
// AKDT
// Alaska Daylight Time
// -08:00
// (GMT -08:00) Alaska Daylight Time
// ----------------------------
// America/Boise
// MDT
// Mountain Daylight Time
// -06:00
// (GMT -06:00) Mountain Daylight Time
// ----------------------------
// America/Chicago
// CDT
// Central Daylight Time
// -05:00
// (GMT -05:00) Central Daylight Time
// ----------------------------
// America/Detroit
// EDT
// Eastern Daylight Time
// -04:00
// (GMT -04:00) Eastern Daylight Time
// ----------------------------
// America/Los_Angeles
// PDT
// Pacific Daylight Time
// -07:00
// (GMT -07:00) Pacific Daylight Time
// ----------------------------
// Pacific/Honolulu
// HST
// Hawaii Standard Time
// -10:00
// (GMT -10:00) Hawaii Standard Time
// ----------------------------
Bench\Bench;
//get the countries. time zones are lazy-loaded per country. they dont get loaded until you call the getter the first time.
$countries = Bench::getCountries();
print_r($countries[0]);
// Bench\Country Object
// (
// [code:protected] => AF
// [name:protected] => Afghanistan
// [timeZones:protected] => Array
// (
// )
//
// )