3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('serialize_precision', 60); // ini_set('serialize_precision', -1); echo 'serialize_precision: ', ini_get('serialize_precision'), PHP_EOL; $points = [ [45.29077, 5.63361], [45.29083, 5.63384] ]; $feature = [ "type" => "Feature", "geometry" => [ "type" => "LineString", "coordinates" => array_map('array_reverse', $points) ], "properties" => [] ]; $json_parcours = [ "type" => "FeatureCollection", "features" => [$feature] ]; $jsonData = json_encode($json_parcours, JSON_UNESCAPED_UNICODE); echo 'jsonData = ', $jsonData, PHP_EOL;
Output for 8.1.31 - 8.1.33, 8.2.24 - 8.2.29, 8.3.5 - 8.3.26, 8.4.1 - 8.4.13
serialize_precision: 60 jsonData = {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"LineString","coordinates":[[5.63361000000000000653699316899292171001434326171875,45.29077000000000197132976609282195568084716796875],[5.63384000000000018104628907167352735996246337890625,45.290829999999999699866748414933681488037109375]]},"properties":[]}]}

preferences:
63.02 ms | 407 KiB | 5 Q