PHP number_format not showing up as a number. I should display as number instead of string.
$calc = "500020.66000000";
$calc = number_format((float)$calc, 2, '.', '');
$return_data =
[
'data' => [
'balance' => number_format((float)$calc, 2, '.', ''),
],
];
return
{
"data": {
"balance": "500020.66",
"currency": "TRY"
}
}
must be
{
"data": {
"balance": 500020.66,
"currency": "TRY"
}
}
Fixed:
php.ini add
serialize_precision=-1
round($calc,2);