3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s1 = bchexdec('44e1ff2dfd8102cf7a47c21d5c9fd5701610d04953c6836596b4fe9dd2f53e3e'); $s2 = bchexdec('9a5f1c75e461d7ceb1cf3cab9013eb2dc85b6d0da8c3c6e27e3a5a5b3faa5bab'); echo bcdechex(invmod($s1, -$s2)); function invmod($a,$b) { $n=$b; $x=0; $lx=1; $y=1; $ly=0; while ($b) { $t=$b; $q=bcdiv($a,$b,0); $b=bcmod($a,$b); $a=$t; $t=$x; $x=bcsub($lx,bcmod(bcmul($q,$x),$n)); $lx=$t; $t=$y; $y=bcsub($ly,bcmod(bcmul($q,$y),$n)); $ly=$t; } if (bccomp($lx,0) == -1) $lx=bcadd($lx,$n); return $lx; } function bchexdec($hex) { if(strlen($hex) == 1) { return hexdec($hex); } else { $remain = substr($hex, 0, -1); $last = substr($hex, -1); return bcadd(bcmul(16, bchexdec($remain)), hexdec($last)); } } function bcdechex($dec) { $last = bcmod($dec, 16); $remain = bcdiv(bcsub($dec, $last), 16); if($remain == 0) { return dechex($last); } else { return bcdechex($remain).dechex($last); } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ValueError: bcdiv(): Argument #2 ($num2) is not well-formed in /in/qqi85:12 Stack trace: #0 /in/qqi85(12): bcdiv('311565754784503...', '-6.982422558024...', 0) #1 /in/qqi85(5): invmod('311565754784503...', -6.982422558024E+76) #2 {main} thrown in /in/qqi85 on line 12
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
58.62 ms | 401 KiB | 8 Q