0

This is my array

$data['myarray'] = ["1" => 1.2, "10" => 0.911, "50" => 0.811, "100" => 0.37];

if using json_encode it will display like json_encode($data['myarray']

{"1":{"1":1.2,"10":0.91100000000000003,"50":0.81100000000000005,"100":0.37}}

I don't understand why my var has change to other number

Thoman
  • 742
  • 2
  • 9
  • 20

1 Answers1

0

add this config

ini_set('serialize_precision', 14); ini_set('precision', 14); This is issue from php 7.1

Thoman
  • 742
  • 2
  • 9
  • 20