<?php foreach ([ 46.8, 36 * 1.3, 46.800000000000004, (36 * 1.3) . "" ] as $n) print ("$n " . print_r ($n, 1) . " " . json_encode ($n) . "\n"); 46.8 46.8 46.8 46.8 46.8 46.800000000000004 46.8 46.8 46.800000000000004 46.8 46.8 "46.8" <?php echo number_format(36 * 1.3, 16); prints 46.8000000000000043 My site is free of ads and trackers. Was this post helpful to you? Why not Reference: PHP Playground