Confused by the behavior of bitwise or operator in php

';   echo gettype($c);  ?>  

The above code outputs a value "egg" and the type 'string'.
  When I used logical OR operator it outputs 1 and type 'boolean'.

This is the simple code that make me confused. I'm a newbie in PHP so I don't know that using bitwise/logical OR operator in string is really valid or not. If valid then why it outputs like this.
  Thank you in advance.


The bitwise-or operator 'adds' the bits of all letters one by one. Look at the ASCII table for the letter codes:

'a' == 0x61   'd' == 0x64  'a' | 'd' == 0x61 | 0x64 == 0x65 == 'e'  

and so on.

The result of 'abc' | 'def' trully is an 'egg' :D