I have a JSON object with order information in. Within this object is an amount for example "amount" : "82.95"
I have this within a variable called $amount
and I am using it within an array by doing (int)$amount
.
The problem with this is that it is removing the .95
which is required as it is an integer.
How can I get this value as a number and not a string not string but retain the .95
?
Example:
$amount = 82.95;
echo (int)$amount;
// Result = 82