variant_div
(PHP 5)
variant_div — Returns the result from dividing two variants
Descrierea
Divides left by right and returns the result.
Parametri
- left
-
The left operand.
- right
-
The right operand.
Notă: Ca şi în cazul tuturor funcţiilor aritmetice de variante, parametrii pentru această funcţie pot fi sau de un tip PHP indigen (integer, string, floating point, boolean sau NULL), sau o instanţă a claselor COM, VARIANT sau DOTNET. Tipurile PHP indigene vor fi convertite în variante utilizând aceleaşi reguli ca şi cele din constructorul VARIANT clasei. De la obiectele COM şi DOTNET se va lua valoarea proprietăţii lor implicite şi va fi utilizată ca valoare a variantei.
Funcţiile aritmetice ale variantelor sunt nişte învelişuri ale funcţiilor denumite similar în biblioteca COM; pentru informaţii suplimentare despre aceste funcţii consultaţi biblioteca MSDN. Funcţiile PHP sunt denumite un pic diferit; spre exemplu, variant_add() din PHP corespunde cu VarAdd() în documentaţia MSDN.
Valorile întroarse
| 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 |
Vedeţi de asemenea
- variant_idiv() - Converts variants to integers and then returns the result from dividing them
variant_div
