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; }
Output for 8.6.0rc7
--- 1.1 string: 1.1 int: 1 string(3) "1.1" string(8) "No error" sprintf: 1.100000 1 1.1 number_format: 1 --- NAN string: Warning: unexpected NAN value was coerced to string in /in/TPOsd on line 5 NAN int: Warning: The float NAN is not representable as an int, cast occurred in /in/TPOsd on line 6 0 bool(false) string(34) "Inf and NaN cannot be JSON encoded" sprintf: Warning: The float NAN is not representable as an int, cast occurred in /in/TPOsd on line 8 Warning: unexpected NAN value was coerced to string in /in/TPOsd on line 8 NaN 0 NAN number_format: nan --- INF string: INF int: Warning: The float INF is not representable as an int, cast occurred in /in/TPOsd on line 6 0 bool(false) string(34) "Inf and NaN cannot be JSON encoded" sprintf: Warning: The float INF is not representable as an int, cast occurred in /in/TPOsd on line 8 INF 0 INF number_format: inf

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
26.05 ms | 1512 KiB | 8 Q