The reason is because ($a, $b, $c, $d) are all strings. That means "|" works on strings, bytewise: "189" | "2" yields "389". That is unlike 189 | 2 which returns 191 — where the operands are treated as integers.

Just converting one string into a number is enough to force "|" into numerical mode.