PHP - 187 182182 163 bytes
<?php $s;function i($v){return strtr($v,[1,0]);}function m($f,$a){return array_map($f,$a);}echo$s=$_GET["s"];$m="array_map";echo implodejoin(m$m("chr",m$m("bindec",m("i",m("strrev",m("decbin",m("ord",str_split$m($s))))))));?>
Ungolfed:
<?php
$s;
function i($v)
{
return strtr($v,[1,0]); // Replaces every occurrence of 1 by 0 and 0 by 1 on $v
}
function m($f, $a)
{
return array_map($f, $a);
}
echo implode(
m("chr", // Get the ASCII character from a decimal value
m("bindec", // Convert from binary to decimal
m("i", // Invert the binary value
m$m("strrev", // Reverse the string
m$m("decbin", // Convert from decimal to binary
m$m("ord",str_split($s)) // Get the decimal ASCII value
)
)
)
)
)
);
?>
SetPass the value toas $sGET["s"]
.
array_map returns an array with all the elements of the second parameter (an array) after applying the callback function (first parameter) to all of them.
Not sure if I should take the 15% off, since echo
doesn't output unprintable characters, but I didn't remove them.
Just glad I finished, since this is the first challenge I take part.