array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.variant-mul.php', 1 => 'variant_mul', 2 => 'Multiplies the values of the two variants', ), 'up' => array ( 0 => 'ref.com.php', 1 => 'COM 函数', ), 'prev' => array ( 0 => 'function.variant-mod.php', 1 => 'variant_mod', ), 'next' => array ( 0 => 'function.variant-neg.php', 1 => 'variant_neg', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/com/functions/variant-mul.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

variant_mul

(PHP 5, PHP 7, PHP 8)

variant_mulMultiplies the values of the two variants

说明

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

Multiplies left by right.

参数

left

The left operand.

right

The right operand.

Boolean values are converted to -1 for false and 0 for true.

注意:

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

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

返回值

Variant Multiplication Rules
If Then
Both expressions are of the string, date, character, boolean type Multiplication
One expression is a string type and the other a character Multiplication
One expression is numeric and the other is a string Multiplication
Both expressions are numeric Multiplication
Either expression is NULL NULL is returned
Both expressions are empty Empty string is returned

错误/异常

Throws a com_exception on failure.

参见