Skip to content
On this page

Expression: Bitwise Operations

Bitwise And

Bitwise and can be used to evaluate two expressions using the & operator, followed by the expression to evaluate to the right.

$foo = $bar & $baz;

Bitwise Or

Bitwise or can be used to evaluate two expressions using the | operator, followed by the expression to evaluate to the right.

$foo = $bar | $baz;

Bitwise Xor

Bitwise xor can be used to evaluate two expressions using the ^ operator, followed by the expression to evaluate to the right.

$foo = $bar ^ $baz;

Bitwise Not

Bitwise not can be used to evaluate an expression using the ~ operator.

$foo = ~$bar;

Bitwise Shift Left

Bitwise shift left can be used to evaluate two expressions using the << operator, followed by the expression to evaluate to the right.

$foo = $bar << $baz;

Bitwise Shift Right

Bitwise shift right can be used to evaluate two expressions using the >> operator, followed by the expression to evaluate to the right.

$foo = $bar >> $baz;

Licensed under either of the MIT License or the Apache License (Version 2.0), at your option.