3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $num = base_convert("fffffffffffffffe",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 = '0x'.$str; $result = bcadd($converted, "1",0); var_dump(-$result);
Output for 5.0.0 - 5.4.45, 5.5.35, 5.6.21 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.6 - 7.1.0
int(-1)
Output for 7.0.0 - 7.0.5
Fatal error: Uncaught Error: Call to undefined function bcadd() in /in/7J2DZ:10 Stack trace: #0 {main} thrown in /in/7J2DZ on line 10
Process exited with code 255.
Output for 5.5.0 - 5.5.34, 5.6.0 - 5.6.20
Fatal error: Call to undefined function bcadd() in /in/7J2DZ on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: str_split() in <b>/in/7J2DZ</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: str_split() in <b>/in/7J2DZ</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: str_split() in <b>/in/7J2DZ</b> on line <b>3</b><br />