3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = gmp_init(42); $b = gmp_init(17); // Pre-5.6 code: var_dump(gmp_add($a, $b)); var_dump(gmp_add($a, 17)); var_dump(gmp_add(42, $b)); // New code: var_dump($a + $b); var_dump($a + 17); var_dump(42 + $b);
based on 2Nolr
Output for 5.6.0 - 5.6.20, 5.6.28, 7.0.0 - 7.0.5, 7.0.14 - 7.1.0
object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" }
Output for 7.0.6 - 7.0.11
Fatal error: Uncaught Error: Call to undefined function gmp_init() in /in/HaINV:2 Stack trace: #0 {main} thrown in /in/HaINV on line 2
Process exited with code 255.
Output for hhvm-3.10.0 - 3.13.2
object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" } object(GMP)#3 (1) { ["num"]=> string(2) "59" } Notice: Object of class GMP could not be converted to int in /in/HaINV on line 11 Notice: Object of class GMP could not be converted to int in /in/HaINV on line 11 int(2) Notice: Object of class GMP could not be converted to int in /in/HaINV on line 12 int(18) Notice: Object of class GMP could not be converted to int in /in/HaINV on line 13 int(43)
Output for 5.0.0 - 5.3.29, 5.5.35 - 5.5.38, 5.6.21 - 5.6.26
Fatal error: Call to undefined function gmp_init() in /in/HaINV on line 2
Process exited with code 255.
Output for 5.4.0 - 5.5.34
resource(6) of type (GMP integer) resource(7) of type (GMP integer) resource(9) of type (GMP integer) int(9) int(21) int(47)
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: gmp_init() in /in/HaINV on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: gmp_init() in /in/HaINV on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: gmp_init() in /in/HaINV on line 2