Skip to content

Instantly share code, notes, and snippets.

@liut
Created March 20, 2015 06:14
Show Gist options
  • Select an option

  • Save liut/7b1173fb6af38c1a195e to your computer and use it in GitHub Desktop.

Select an option

Save liut/7b1173fb6af38c1a195e to your computer and use it in GitHub Desktop.
php locales
<?php
$arr = array(
'language'=>'en' ,
'script' =>'Hans' ,
'region' =>'CN',
'variant2'=>'rozaj' ,
'variant1'=>'nedis' ,
'private1'=>'prv1' ,
'private2'=>'prv2'
);
echo locale_compose( $arr );
echo PHP_EOL;
$local = 'en_Hans_CN_nedis_rozaj_x_prv1_prv2';
$arr = locale_parse($local);
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment