3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = 0x40; $b = ~$a; // flip bits, i.e. 2s complement so -$a and then minus 1 var_dump("var_dump: $b"); // -65 printf("\nprintf: %d\n\n", $b); var_dump( base_convert($b, 10, 2) ); // 65 // **************************// // should be: printf("\nprintf: %d\n\n", $b); printf("\nprintf:%b\n\n",-65); printf("\nprintf: %d\n\n",1111111111111111111111111111111111111111111111111111111110111111b);
based on 1IvbM
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected 'b' (T_STRING), expecting ',' or ')' in /in/8dYIR on line 14
Process exited with code 255.
Output for 5.4.12 - 5.6.17
Parse error: syntax error, unexpected 'b' (T_STRING) in /in/8dYIR on line 14
Process exited with code 255.
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/8dYIR on line 14
Process exited with code 255.