On My PHP server Float values changes when i print on website in json format. but working ok on localhost.
Code:
$float = 1.440030394;
$value = round($float,5); // 1.44003
$response = array();
$response['status'] = true;
$response['message'] = "success";
$response['values'] = $value;
echo json_encode($response);
// test if value is really true?
echo "<br>test<br>";
echo $value."-abc"; // Work ok if float convert to string
Localhost Response is ok, but on Live server response is
{
"status": true,
"message": "success",
"values": 1.44035442150000012452200154
}
Test
1.44003-abc
Any solutions? i try functions : round, number_format but not working.