- decbin: documentation ( source)
- str_pad: documentation ( source)
- str_split: documentation ( source)
<?php
$a = 0; $b = 1;
echo "foo ", $a^$b, "\n";
echo "a | b\n";
for($i = 0; $i < 4; $i++){
list($a, $b) = str_split(str_pad(decbin($i), 2, 0, STR_PAD_LEFT));
echo "$a | $b | ", $a^$b, "\n";
}