查詢

variant_div()函式—用法及示例

「 返回兩個變數相除的結果 」


(PHP 5, PHP 7, PHP 8)

variant_div — 返回兩個變數相除的結果

說明

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

左除以右並返回結果。

引數
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()。

返回值

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 emptycom_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 emptycom_exception with code DISP_E_OVERFLOW is thrown
錯誤/異常
失敗時丟擲com異常。

補充糾錯
上一個函式: variant_eqv()函式
熱門PHP函式
分享連結