Q:

Can anyone explain this PHP code to me? Unexpected result from a single line of code

Can someone explain what is PHP doing here and if it is possible to get predictable result?
Could this be used for hiding messages?
echo '1' | 'z';

A:

It's using a bitwise OR operator
'1' = ASCII 0x31 = Binary 00110001
'z' = ASCII 0x7A = Binary 01111010

ORing the two gives
  00110001  1
| 01111010  z
= 01111011  {

which is 0x7B
which is ASCII character {
And as has been pointed out, to make this reversible, XOR should be used rather than OR
XORing the two gives
  00110001  1
^ 01111010  z
= 01001011  K

which is 0x4B
which is ASCII character K
Reversing:
  01001011  K
^ 01111010  z
= 00110001  1

EDIT
It's not a particularly strong code, but:
$plainTextMessage = "My secret message";
$secretCharacter = 'z';

$codedMessage = '';
for($i = 0; $i < strlen($plainTextMessage); $i++) {
    $codedMessage .= $plainTextMessage[$i] ^ $secretCharacter;
}
echo 'Coded Message is: '.$codedMessage.PHP_EOL;

$decodedMessage = '';
for($i = 0; $i < strlen($codedMessage); $i++) {
    $decodedMessage .= $codedMessage[$i] ^ $secretCharacter;
}

echo 'Decoded Message is: '.$decodedMessage.PHP_EOL;

