(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()。
返回值
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 |
失敗時丟擲com異常。