$a | $b

Binary or

Binary "or" operation.

Tags
$a = 0b01;
$b = 0b01;
$c = 0b10;
$d = 0b11;

var_dump($a | $b); // 0b01, 1
var_dump($b | $c); // 0b11, 3
var_dump($a | $d); // 0b11, 3
var_dump($c | $d); // 0b11, 3

null coalescing

What is this? Who are you!?

PHP Operators is a reference guide for operators old and new in the PHP programming language. We're SPATIE, a web development agency from Belgium. Besides client work we like to contribute to the open source community and make fun projects like this one.