- var_dump: documentation ( source)
- json_decode: documentation ( source)
- round: documentation ( source)
- json_encode: documentation ( source)
<?php
$array = [round(-0.1), round(0.1)]; // [-0,0]
var_dump($array); // Array ( [0] => -0 [1] => 0 )
$json = json_encode($array, JSON_PRESERVE_ZERO_FRACTION); // "[-0,0]"
$array = json_decode($json); // [0,0]
var_dump($array); // Array ( [0] => 0 [1] => 0 )