I am having a very different question. For some reason, when the json_encode function receives a variable that has the value assigned by a multiplication, the echo
result will be a different value than expected. Example:
<?php
$test = 1.1 * 122;
echo json_encode(array("test" => $test)); // prints {"test":134.20000000000002}
echo $test; // prints 134.2
?>
For some reason, it doesn't work on every version of PHP, so I created a snippet on a tester that works: Online Tester
Why does this happen?