PHP -r
(891 680 674 bytes, 2 0 DNP)
Edit: saved 203 bytes thanks to jimmy23013 and implemented the 2 DNP thanks to Mego
This answer heavily abuses PHP's generous nature. Most of the cases take one of these forms (7 bytes each):
<?=Y^x;
<?=Z&e;
<?=V|Z;
PHP converts the letters on either side of the operator to strings, then performs the appropriate bitwise operation by converting each string to its ASCII character value, and finally converts the result back to a character.
In the first example above, Y^x
becomes 89^78
. The result of this is 33
, which is then sent to STDOUT as the character !
.
A script was written to bruteforce all possible combinations: the results can be found here.
Exceptions:
;
is <?=Z^a?>
(8 bytes)
|
is <?='9'^E;
(9 bytes)
<
and ?
would normally be DNP due to the required start tag, but by using the -r
flag, code can be executed without them:
<
is echo Z^f;
(9 bytes)
?
is echo Z^e;
(9 bytes)
=
is echo Z^g;
(9 bytes)
Score:
(7 * 90) + 8 + 9 + 9 + 9 + 9 = 674 bytes