3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "int cast: ",(int)(0xffffffffffffffff & 0xffff); // -1 printf("\nprintf: %d\n",0xffffffff); // treat as a signed number -- first gets cast to an int? echo "hexdec: "; var_dump((int) hexdec("ffffffff")); printf("\nprintf max int in hex: %x\n",PHP_INT_MAX); echo 0x5,"\n"; echo ~0x5 + 1,"\n"; // transform to -5 $n = sprintf("0x%x", (pow(2,32) - 5) ); // get 2s complement var_dump($n); $i = intval($n + 0); // trick that doesn't work anymore with PHP 7 echo $i; var_dump($i); printf("%x",$i); // display binary as hex $r = 0xffffffff & 0xfffffffb; // anding to simplify var_dump($r); echo 0xfb - pow(2,8); // to detect value of hex printf("\n%x\n",(pow(2, 32) - 5)); echo (5 + 0xfffffffb) == pow(2,32)? 'true':'false'; // floats both echo "\n",0xfffffffb > 0x7fffffff? 'true':'false';
Output for git.master, git.master_jit, rfc.property-hooks
int cast: Deprecated: Implicit conversion from float 1.8446744073709552E+19 to int loses precision in /in/8F6r8 on line 3 0 printf: 4294967295 hexdec: int(4294967295) printf max int in hex: 7fffffffffffffff 5 -5 string(10) "0xfffffffb" Warning: A non-numeric value encountered in /in/8F6r8 on line 13 0int(0) 0int(4294967291) -5 fffffffb true true

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:
21.02 ms | 406 KiB | 5 Q