3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 0x40; $b = ~$a; // flip bits, i.e. 2s complement so -$a and then minus 1 var_dump($b); // -65 decimal var_dump(base_convert($b, 10, 2), $b); // 65
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
int(-65) Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /in/0EmWn on line 5 string(7) "1000001" int(-65)
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
int(-65) string(7) "1000001" int(-65)

preferences:
208.8 ms | 403 KiB | 212 Q