Php获取LC_MONETARY的当前区域设置

dan*_*car 2 php locale

我正在使用此代码显示当前区域设置中的金额.

setlocale(LC_MONETARY, 'it_IT');
echo money_format('%i', $number);
Run Code Online (Sandbox Code Playgroud)

我的问题是,如何查看LC_MONETARY的当前值?如果我做一个简单的回声,值看起来是一样的,我找不到任何getlocale函数.

echo LC_MONETARY;
setlocale(LC_MONETARY, 'it_IT');
echo LC_MONETARY;
Run Code Online (Sandbox Code Playgroud)

更新:LC_MONETARY是受影响的功能类别,因此值是相同的.但是,如何查看当前的区域设置信息呢?

Ste*_*rig 18

$oldLocale = setlocale(LC_MONETARY, 'it_IT');
// setlocale() will return the old value if the locale could 
// be set (return value greatly depends on the system's underlying 
// setlocale() implementation)

$oldLocale = setlocale(LC_MONETARY, '0');
// using '0' as the locale-argument will result in the current setting 
//being returned without affecting the locale setting itself
Run Code Online (Sandbox Code Playgroud)

请参阅文档中$locale参数的注释setlocale().