3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $bc = (object) NULL; $gmp = (object) NULL; $bc->a = "3"; $bc->b = "2"; $bc->c = bcdiv($bc->a, $bc->b); var_dump($bc->c); $gmp->a = gmp_init(3); $gmp->b = gmp_init(2); $gmp->c = gmp_div($gmp->a, $gmp->b); var_dump((string) $gmp->c);
Output for 5.6.8 - 5.6.12, 5.6.16 - 5.6.19, 5.6.28, 7.0.0 - 7.0.4, 7.0.14 - 7.1.0
string(1) "1" string(1) "1"
Output for 7.0.6
string(1) "1" Fatal error: Uncaught Error: Call to undefined function gmp_init() in /in/iXRS1:11 Stack trace: #0 {main} thrown in /in/iXRS1 on line 11
Process exited with code 255.
Output for 7.0.5
Fatal error: Uncaught Error: Call to undefined function bcdiv() in /in/iXRS1:8 Stack trace: #0 {main} thrown in /in/iXRS1 on line 8
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
string(1) "1" Catchable fatal error: Object of class GMP could not be converted to string in /in/iXRS1 on line 14
Process exited with code 255.
Output for 5.0.0 - 5.4.32, 5.5.35, 5.6.21
string(1) "1" Fatal error: Call to undefined function gmp_init() in /in/iXRS1 on line 11
Process exited with code 255.
Output for 5.5.29 - 5.5.30, 5.5.34, 5.6.13 - 5.6.15, 5.6.20
Fatal error: Call to undefined function bcdiv() in /in/iXRS1 on line 8
Process exited with code 255.
Output for 5.4.34 - 5.5.28, 5.5.31 - 5.5.33
string(1) "1" string(14) "Resource id #6"
Output for 4.4.5 - 4.4.9
string(1) "1" Fatal error: Call to undefined function: gmp_init() in /in/iXRS1 on line 11
Process exited with code 255.
Output for 4.3.2 - 4.4.4
string(1) "1" Fatal error: Call to undefined function: gmp_init() in /in/iXRS1 on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string(1) "1" Fatal error: Call to undefined function: gmp_init() in /in/iXRS1 on line 11