3v4l.org

run code in 500+ PHP versions simultaneously
<?php $f = INF; var_dump((string)$f); var_dump((int)$f); var_dump((bool)$f); echo "--\n"; $f = NAN; var_dump((string)$f); var_dump((int)$f); var_dump((bool)$f);
Output for 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.33, 8.4.1 - 8.4.24
string(3) "INF" int(0) bool(true) -- string(3) "NAN" int(0) bool(true)
Output for 8.5.0 - 8.5.11
string(3) "INF" Warning: The float INF is not representable as an int, cast occurred in /in/lYIng on line 5 int(0) bool(true) -- Warning: unexpected NAN value was coerced to string in /in/lYIng on line 11 string(3) "NAN" Warning: The float NAN is not representable as an int, cast occurred in /in/lYIng on line 12 int(0) Warning: unexpected NAN value was coerced to bool in /in/lYIng on line 13 bool(true)

preferences:
32.67 ms | 1139 KiB | 10 Q