3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 200.51; $b = 200.50; print_r(abs($a-$b)); print_r(abs(gmp_sub($a, $b)));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
0.0099999999999909 Deprecated: Implicit conversion from float 200.51 to int loses precision in /in/UPj3W on line 7 Deprecated: Implicit conversion from float 200.5 to int loses precision in /in/UPj3W on line 7 Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of type int|float, GMP given in /in/UPj3W:7 Stack trace: #0 /in/UPj3W(7): abs(Object(GMP)) #1 {main} thrown in /in/UPj3W on line 7
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
0.0099999999999909 Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of type int|float, GMP given in /in/UPj3W:7 Stack trace: #0 /in/UPj3W(7): abs(Object(GMP)) #1 {main} thrown in /in/UPj3W on line 7
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33, 8.0.13
0.0099999999999909 Fatal error: Uncaught Error: Call to undefined function gmp_sub() in /in/UPj3W:7 Stack trace: #0 {main} thrown in /in/UPj3W on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
0.0099999999999909 Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in /in/UPj3W on line 7 0
Output for 5.5.0 - 5.5.38
0.0099999999999909 Fatal error: Call to undefined function gmp_sub() in /in/UPj3W on line 7
Process exited with code 255.

preferences:
255.22 ms | 401 KiB | 324 Q