3v4l.org

run code in 300+ PHP versions simultaneously
<?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 )

preferences:
62.58 ms | 402 KiB | 5 Q