Dutch PHP Conference 2025 - Call For Papers

variant_div

(PHP 5, PHP 7, PHP 8)

variant_divReturns the result from dividing two variants

Опис

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

Divides left by right and returns the result.

Параметри

left

The left operand.

right

The right operand.

Зауваження:

Як і у всіх інших варіантних арифметичних функцій, параметри цієї функції можуть мати PHP-тип (ціле число, рядок, десятковий дріб, логічний або null) або бути примірником класу COM, VARIANT чи DOTNET. Типи, вбудовані в PHP, будуть перетворені у "варіанти" за правилами, описаними в конструкторі класу variant. В об'єктів COM і DOTNET значеннями "варіантів" будуть початкові значення властивостей цих об'єктів.

Варіантні арифметичні функції є надбудовами однойменних функцій бібліотеки COM. Докладніша інформація про ці функції є в документації до бібліотеки MSDN. Функції в PHP називаються дещо інакше, ніж в бібліотеці MDSN. Наприклад, variant_add() в PHP відповідає VarAdd() в MSDN.

Значення, що повертаються

Variant Division Rules
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.

Прогляньте також

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

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top