variant_and

(PHP 5, PHP 7, PHP 8)

variant_andPerforms a bitwise AND operation between two variants

說明

variant_and(mixed $left, mixed $right): variant

Performs a bitwise AND operation. Note that this is slightly different from a regular AND operation.

參數

left

The left operand.

right

The right operand.

注意:

對于所有變量運算函數,本函數的參數可以是 PHP 內置的類型(整數,字符串,浮點數,布爾型或者 null),或者是一個 COM,VARIANT 或者 DOTNET 類的實例。PHP 內置類型將會使用和構造variant類相同的規(guī)則轉換成變量。COM 和 DOTNET 對象的值將會取其默認屬性并被當成變量值使用。

變量運算函數是同名函數在 COM 庫中的外包;有關此類函數的更多信息參見 MSDN 庫。PHP 函數命名有少許區(qū)別,例如 PHP 中的 variant_add() 對應于 MSDN 文檔中的 VarAdd()。

返回值

Variant AND Rules
If left is If right is then the result is
truetruetrue
truefalsefalse
truenullnull
falsetruefalse
falsefalsefalse
falsenullfalse
nulltruenull
nullfalsefalse
nullnullnull

錯誤/異常

Throws a com_exception on failure.

參見

  • variant_or() - Performs a logical disjunction on two variants