variant_mul

(PHP 5, PHP 7, PHP 8)

variant_mulMultiplies the values of the two variants

說(shuō)明

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

Multiplies left by right.

參數(shù)

left

The left operand.

right

The right operand.

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

注意:

對(duì)于所有變量運(yùn)算函數(shù),本函數(shù)的參數(shù)可以是 PHP 內(nèi)置的類(lèi)型(整數(shù),字符串,浮點(diǎn)數(shù),布爾型或者 null),或者是一個(gè) COM,VARIANT 或者 DOTNET 類(lèi)的實(shí)例。PHP 內(nèi)置類(lèi)型將會(huì)使用和構(gòu)造variant類(lèi)相同的規(guī)則轉(zhuǎn)換成變量。COM 和 DOTNET 對(duì)象的值將會(huì)取其默認(rèn)屬性并被當(dāng)成變量值使用。

變量運(yùn)算函數(shù)是同名函數(shù)在 COM 庫(kù)中的外包;有關(guān)此類(lèi)函數(shù)的更多信息參見(jiàn) MSDN 庫(kù)。PHP 函數(shù)命名有少許區(qū)別,例如 PHP 中的 variant_add() 對(duì)應(yīng)于 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

錯(cuò)誤/異常

Throws a com_exception on failure.

參見(jiàn)

  • variant_div() - Returns the result from dividing two variants
  • variant_idiv() - Converts variants to integers and then returns the result from dividing them