3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $num = base_convert("ffffffffffffffff",16,2); $arr = str_split($num); for ($i=0,$max = count($arr)-1; $i <=$max; $i++) { $arr[$i] = ($arr[$i] == '1')? '0' : '1'; } $str = join('',$arr); $converted = base_convert($str,2,10); $result = gmp_add($converted, "1"); var_dump(-$result);
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)#2 (1) { ["num"]=> string(21) "-18446744073709552047" }
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function gmp_add() in /in/Nv6rO:10 Stack trace: #0 {main} thrown in /in/Nv6rO on line 10
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Object of class GMP could not be converted to int in /in/Nv6rO on line 11 int(-1)
Output for 5.0.0 - 5.3.29, 5.5.35, 5.6.21
Fatal error: Call to undefined function gmp_add() in /in/Nv6rO on line 10
Process exited with code 255.
Output for 5.4.0 - 5.5.34
int(-6)
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/Nv6rO on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/Nv6rO on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/Nv6rO on line 3