3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Utils { public static function areFloatNumbersEquals($num1, $num2, $precision = 2) { if(!is_int($precision) || $precision < 0 || $precision > 7){ throw new InvalidArgumentException('Invalid param precision'); } $num1 = round((float) $num1, $precision); $num2 = round((float) $num2, $precision); return $num1 == $num2; } } if(Utils::areFloatNumberEquals(0.054436, 0.054399, 3)){ echo 'equals'; } else { echo 'different'; }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined method Utils::areFloatNumberEquals() in /in/2G6XH:17 Stack trace: #0 {main} thrown in /in/2G6XH on line 17
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:
37.39 ms | 401 KiB | 8 Q