PHP code example of macmotp / locale
1. Go to this page and download the library: Download macmotp/locale 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/ */
macmotp / locale example snippets php
use Macmotp\Country;
// Create the object
$countryCode = Country::US; // Use alpha2 ISO code
$country = new Country($countryCode);
// equivalent to:
// $country = Country::make($countryCode);
echo $country->toArray();
// [
// 'continent' => 'North America',
// 'name' => 'United States of America',
// 'capital' => 'Washington DC',
// 'code' => 'US',
// 'alpha3_code' => 'USA',
// 'dial_code' => '+1',
// 'tld' => '.us',
// 'date_format' => 'm-d-Y',
// 'default_currency_code' => 'USD',
// 'default_timezone' => 'America/New_York',
// 'default_language' => 'en',
// 'currencies' => ['USD'],
// 'timezones' => ['America/New_York', ...],
// 'languages' => ['en', ...],
// ]
php
// Example
use Macmotp\Country;
$country = new Country(Country::US);
echo $country->getDefaultCurrency();
// (string) USD
php
// Example
use Macmotp\Country;
$country = new Country(Country::US);
echo $country->getDefaultCurrency();
// (string) USD