3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a($value) { $frequency = (float) $value; return is_nan($frequency) ? null : $frequency; } function b($value) { $frequency = $value; return is_nan($frequency) ? null : (float) $frequency; } function meh($value) { var_dump(a($value) === b($value)); } foreach (array(0, NAN, "asdf", 2.4) as $value) { meh($value); }
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) bool(true) Fatal error: Uncaught TypeError: is_nan(): Argument #1 ($num) must be of type float, string given in /in/pchku:10 Stack trace: #0 /in/pchku(10): is_nan('asdf') #1 /in/pchku(14): b('asdf') #2 /in/pchku(18): meh('asdf') #3 {main} thrown in /in/pchku on line 10
Process exited with code 255.

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:
42.12 ms | 401 KiB | 8 Q