3v4l.org

run code in 500+ PHP versions simultaneously
<?php foreach ([1.1, NAN, INF] as $f) { echo "--- ", var_export($f, true), PHP_EOL; echo 'string: ', (string) $f, PHP_EOL; echo 'int: ', (int) $f, PHP_EOL; var_dump(json_encode($f), json_last_error_msg()); echo 'sprintf: ', sprintf('%f %d %s', $f, $f, $f), PHP_EOL; echo 'number_format: ', number_format($f), PHP_EOL; }

preferences:
32.76 ms | 492 KiB | 6 Q