(PHP 5, PHP 7, PHP 8)
variant_div — Returns the result from dividing two variants
Divides left
by right
and
returns the result.
left
The left operand.
right
The right operand.
注意:
對于所有變量運算函數,本函數的參數可以是 PHP 內置的類(lèi)型(整數,字符串,浮點(diǎn)數,布爾型或者
null
),或者是一個(gè) COM,VARIANT 或者 DOTNET 類(lèi)的實(shí)例。PHP 內置類(lèi)型將會(huì )使用和構造variant類(lèi)相同的規則轉換成變量。COM 和 DOTNET 對象的值將會(huì )取其默認屬性并被當成變量值使用。變量運算函數是同名函數在 COM 庫中的外包;有關(guān)此類(lèi)函數的更多信息參見(jiàn) MSDN 庫。PHP 函數命名有少許區別,例如 PHP 中的 variant_add() 對應于 MSDN 文檔中的
VarAdd()
。
If | Then |
---|---|
Both expressions are of the string, date, character, boolean type | Double is returned |
One expression is a string type and the other a character | Division and a double is returned |
One expression is numeric and the other is a string | Division and a double is returned. |
Both expressions are numeric | Division and a double is returned |
Either expression is NULL | NULL is returned |
right is empty and
left is anything but empty |
A com_exception with code DISP_E_DIVBYZERO
is thrown |
left is empty and
right is anything but empty. |
0 as type double is returned |
Both expressions are empty | A com_exception with code DISP_E_OVERFLOW
is thrown |
Throws a com_exception on failure.