--TEST-- Test setlocale() function : basic functionality - passing multiple locales as argument --SKIPIF-- --FILE-- "USD", "en_AU.utf8" => "AUD", "ko_KR.utf8" => "KRW", "zh_CN.utf8" => "CNY", "de_DE.utf8" => "EUR", "es_EC.utf8" => "USD", "fr_FR.utf8" => "EUR", "ja_JP.utf8" => "JPY", "el_GR.utf8" => "EUR", "nl_NL.utf8" =>"EUR" ); // gather all the locales installed in the system $all_system_locales = list_system_locales(); // Now check for three locales that is present in the system and use that as argument to setlocale() if( in_array("en_US.utf8",$all_system_locales) || in_array("Ko_KR.utf8",$all_system_locales) || in_array("zh_CN.utf8",$all_system_locales) ) { echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --\n"; // call setlocale() $new_locale = setlocale(LC_ALL, "en_US.utf8", "Ko_KR.utf8", "zh_CN.utf8"); // dump the name of the new locale set by setlocale() var_dump($new_locale); // check that new locale setting is effective // use localeconv() to get the details of currently set locale $locale_info = localeconv(); $new_currency = trim($locale_info['int_curr_symbol']); echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n"; echo "Test "; if( trim($currency_symbol[$new_locale]) == $new_currency) { echo "PASSED.\n"; } else { echo "FAILED.\n"; } } echo "Done\n"; ?> --EXPECTF-- *** Testing setlocale() by passing multiple locales as argument *** -- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) -- string(%d) "%s" Checking currency settings in the new locale, expected: %s, Found: %s Test PASSED. Done