I use multiple servers to get data, but when i connect to a specific one, PHP lost the locale configuration.
So i pull data and format money numbers, but on the way of the process, if it connect to that server, then the rest of the process does not format money numbers anymore... money_format() command
localeconv();
Before
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] => USD
[currency_symbol] => $
[mon_decimal_point] => .
[mon_thousands_sep] => ,
[positive_sign] =>
[negative_sign] => -
[int_frac_digits] => 2
[frac_digits] => 2
[p_cs_precedes] => 1
[p_sep_by_space] => 0
[n_cs_precedes] => 1
[n_sep_by_space] => 0
[p_sign_posn] => 1
[n_sign_posn] => 1
[grouping] => Array
(
)
[mon_grouping] => Array
(
[0] => 3
[1] => 3
)
)
After
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] =>
[currency_symbol] =>
[mon_decimal_point] =>
[mon_thousands_sep] =>
[positive_sign] =>
[negative_sign] =>
[int_frac_digits] => 127
[frac_digits] => 127
[p_cs_precedes] => 127
[p_sep_by_space] => 127
[n_cs_precedes] => 127
[n_sep_by_space] => 127
[p_sign_posn] => 127
[n_sign_posn] => 127
[grouping] => Array
(
)
[mon_grouping] => Array
(
)
)
this is the script i ran:
<?PHP
//set locale information
setlocale( LC_MONETARY,'en_US' );
//print location information
print_r(localeconv());
// Array
// (
// [decimal_point] => .
// [thousands_sep] =>
// [int_curr_symbol] => USD
// [currency_symbol] => $
// [mon_decimal_point] => .
// [mon_thousands_sep] => ,
// ...
// )
//************************************************
//create conenction to server
$connection= new PDO("odbc:server", 'username', 'password');
//************************************************
//see locale information after creating a connection
print_r(localeconv());
// Array
// (
// [decimal_point] => .
// [thousands_sep] =>
// [int_curr_symbol] =>
// [currency_symbol] =>
// [mon_decimal_point] =>
// [mon_thousands_sep] =>
// ...
//
// )
?>
How can this happen???? thanks