variant_div

(PHP 5)

variant_div --  Returns the result from dividing two variants

Description

mixed variant_div ( mixed left, mixed right )

Divides left by right and returns the result, subject to the following rules:

表格 1. Variant Division Rules

IfThen
Both expressions are of the string, date, character, boolean typeDouble is returned
One expression is a string type and the other a characterDivision and a double is returned
One expression is numeric and the other is a stringDivision and a double is returned.
Both expressions are numericDivision and a double is returned
Either expression is NULLNULL is returned
right is empty and left is anything but emptyA 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 emptyA com_exception with code DISP_E_OVERFLOW is thrown

注: 對於所有的變量算法函數,此函數的參數可以要麼是 PHP 自身的類型(整型,字串,浮點型,布爾型或是 NULL),要麼是一個 COM,VARIANT 或 DOTNET 類的案例。PHP 自身類型將被轉換為變量,使用與 VARIANT 類的構造函數中相同的規則。COM 和 DOTNET 物件將具有其預設屬性的值,取得並作為變量值使用。

變量算法函數是 COM 庫中與其名稱接近的函數的封裝。此類函數的更多訊息請參考 MSDN 庫。PHP 函數命名有少許不同,例如 PHP 中的 variant_add() 對應於 MSDN 文件中的 VarAdd()。