略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: variant_or

2024-05-04

variant_or

(PHP 5, PHP 7, PHP 8)

variant_orPerforms a logical disjunction on two variants

说明

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

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

参数

left

The left operand.

right

The right operand.

注意:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 null),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 variant_add() 对应于 MSDN 文档中的 VarAdd()

返回值

Variant OR Rules
If left is If right is then the result is
truetruetrue
truefalsetrue
truenulltrue
falsetruetrue
falsefalsefalse
falsenullnull
nulltruetrue
nullfalsenull
nullnullnull

错误/异常

Throws a com_exception on failure.

参见

  • variant_and() - Performs a bitwise AND operation between two variants
  • variant_xor() - Performs a logical exclusion on two variants
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.variant-or.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3