参见

For further information on COM read the » COM specification. You might find some additional useful information in our FAQ for PHP 和 COM. If you're thinking of using MS Office applications on the server side, you should read the information here: » Considerations for Server-Side Automation of Office.

com_create_guid

Generate a globally unique identifier (GUID)

说明

string com_create_guid ( void )

Generates a Globally Unique Identifier (GUID).

A GUID is generated in the same way as DCE UUID's, except that the Microsoft convention is to enclose a GUID in curly braces.

返回值

Returns the GUID as a string.

参见

  • uuid_create in the PECL uuid extension

com_event_sink

Connect events from a COM object to a PHP object

说明

bool com_event_sink ( variant $comobject , object $sinkobject [, mixed $sinkinterface ] )

Instructs COM to sink events generated by comobject into the PHP object sinkobject.

Be careful how you use this feature; if you are doing something similar to the example below, then it doesn't really make sense to run it in a web server context.

参数

comobject

sinkobject
sinkobject should be an instance of a class with methods named after those of the desired dispinterface; you may use com_print_typeinfo to help generate a template class for this purpose.

sinkinterface
PHP will attempt to use the default dispinterface type specified by the typelibrary associated with comobject, but you may override this choice by setting sinkinterface to the name of the dispinterface that you want to use.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 COM event sink example

<?php
class IEEventSinker {
    var $terminated = false;

   function ProgressChange($progress, $progressmax) {
      echo "Download progress: $progress / $progressmax\n";
    }

    function DocumentComplete(&$dom, $url) {
      echo "Document $url complete\n";
    }

    function OnQuit() {
      echo "Quit!\n";
      $this->terminated = true;
    }
}
$ie = new COM("InternetExplorer.Application");
// note that you don't need the & for PHP 5!
$sink = new IEEventSinker();
com_event_sink($ie, $sink, "DWebBrowserEvents2");
$ie->Visible = true;
$ie->Navigate("http://www.example.org");
while(!$sink->terminated) {
  com_message_pump(4000);
}
$ie = null;
?>

参见

  • com_print_typeinfo
  • com_message_pump

com_get_active_object

Returns a handle to an already running instance of a COM object

说明

variant com_get_active_object ( string $progid [, int $code_page ] )

com_get_active_object is similar to creating a new instance of a com object, except that it will only return an object to your script if the object is already running. OLE applications use something known as the "Running Object Table" to allow well-known applications to be launched only once; this function exposes the COM library function GetActiveObject() to get a handle on a running instance.

参数

progid
progid must be either the ProgID or CLSID for the object that you want to access (for example Word.Application).

code_page
Acts in precisely the same way that it does for the com class.

返回值

If the requested object is running, it will be returned to your script just like any other COM object.

错误/异常

There are a variety of reasons why this function might fail, the most common being that the object is not already running. In that situation, the exception error code will be MK_E_UNAVAILABLE; you can use the getCode method of the exception object to check the exception code.

注释

Warning

Using com_get_active_object in a web server context is not always a smart idea. Most COM/OLE applications are not designed to handle more than one client concurrently, even (or especially!) Microsoft Office. You should read » Considerations for Server-Side Automation of Office for more information on the general issues involved.

com_load_typelib

装载一个 Typelib

说明

bool com_load_typelib ( string $typelib_name [, bool $case_insensitive = true ] )

Loads a type-library and registers its constants in the engine, as though they were defined using define.

Note that it is much more efficient to use the configuration setting to pre-load and register the constants, although not so flexible.

If you have turned on , then PHP will attempt to automatically register the constants associated with a COM object when you instantiate it. This depends on the interfaces provided by the COM object itself, and may not always be possible.

参数

typelib_name
typelib_name can be one of the following:

  • The filename of a .tlb file or the executable module that contains the type library.

  • The type library GUID, followed by its version number, for example {00000200-0000-0010-8000-00AA006D2EA4},2,0.

  • The type library name, e.g. Microsoft OLE DB ActiveX Data Objects 1.0 Library.

PHP will attempt to resolve the type library in this order, as the process gets more and more expensive as you progress down the list; searching for the type library by name is handled by physically enumerating the registry until we find a match.

case_insensitive
The case_insensitive behaves in the same way as the parameter with the same name in the define function.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

com_message_pump

Process COM messages, sleeping for up to timeoutms milliseconds

说明

bool com_message_pump ([ int $timeoutms = 0 ] )

This function will sleep for up to timeoutms milliseconds, or until a message arrives in the queue.

The purpose of this function is to route COM calls between apartments and handle various synchronization issues. This allows your script to wait efficiently for events to be triggered, while still handling other events or running other code in the background. You should use it in a loop, as demonstrated by the example in the com_event_sink function, until you are finished using event bound COM objects.

参数

timeoutms
The timeout, in milliseconds.

If you do not specify a value for timeoutms, then 0 will be assumed. A 0 value means that no waiting will be performed; if there are messages pending they will be dispatched as before; if there are no messages pending, the function will return FALSE immediately without sleeping.

返回值

If a message or messages arrives before the timeout, they will be dispatched, and the function will return TRUE. If the timeout occurs and no messages were processed, the return value will be FALSE.

com_print_typeinfo

Print out a PHP class definition for a dispatchable interface

说明

bool com_print_typeinfo ( object $comobject [, string $dispinterface = NULL [, bool $wantsink = FALSE ]] )

The purpose of this function is to help generate a skeleton class for use as an event sink. You may also use it to generate a dump of any COM object, provided that it supports enough of the introspection interfaces, and that you know the name of the interface you want to display.

参数

comobject
comobject should be either an instance of a COM object, or be the name of a typelibrary (which will be resolved according to the rules set out in com_load_typelib).

dispinterface
The name of an IDispatch descendant interface that you want to display.

wantsink
If set to TRUE, the corresponding sink interface will be displayed instead.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

参见

  • com_event_sink
  • com_load_typelib

variant_abs

Returns the absolute value of a variant

说明

variant variant_abs ( mixed $val )

Returns the absolute value of a variant.

参数

val
The variant.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the absolute value of val.

错误/异常

Throws a com_exception on failure.

参见

  • abs

variant_add

"Adds" two variant values together and returns the result

说明

variant variant_add ( mixed $left , mixed $right )

Adds left to right using the following rules (taken from the MSDN library), which correspond to those of Visual Basic:

IfThen
Both expressions are of the string typeConcatenation
One expression is a string type and the other a characterAddition
One expression is numeric and the other is a stringAddition
Both expressions are numericAddition
Either expression is NULLNULL is returned
Both expressions are emptyInteger subtype is returned

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the result.

错误/异常

Throws a com_exception on failure.

参见

  • variant_sub

variant_and

Performs a bitwise AND operation between two variants

说明

variant variant_and ( mixed $left , mixed $right )

Performs a bitwise AND operation. Note that this is slightly different from a regular AND operation.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If left isIf right isthen the result is
TRUETRUETRUE
TRUEFALSEFALSE
TRUENULLNULL
FALSETRUEFALSE
FALSEFALSEFALSE
FALSENULLFALSE
NULLTRUENULL
NULLFALSEFALSE
NULLNULLNULL

错误/异常

Throws a com_exception on failure.

参见

  • variant_or

variant_cast

Convert a variant into a new variant object of another type

说明

variant variant_cast ( variant $variant , int $type )

This function makes a copy of variant and then performs a variant cast operation to force the copy to have the type given by type.

This function wraps VariantChangeType() in the COM library; consult MSDN for more information.

参数

variant
The variant.

type
type should be one of the VT_XXX constants.

返回值

Returns a variant of given type.

参见

  • variant_set_type

variant_cat

Concatenates two variant values together and returns the result

说明

variant variant_cat ( mixed $left , mixed $right )

Concatenates left with right and returns the result.

This function is notionally equivalent to $left . $right.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the result of the concatenation.

错误/异常

Throws a com_exception on failure.

参见

variant_cmp

Compares two variants

说明

int variant_cmp ( mixed $left , mixed $right [, int $lcid [, int $flags ]] )

Compares left with right.

This function will only compare scalar values, not arrays or variant records.

参数

left
The left operand.

right
The right operand.

lcid
A valid Locale Identifier to use when comparing strings (this affects string collation).

flags
flags can be one or more of the following values OR'd together, and affects string comparisons:

valuemeaning
NORM_IGNORECASECompare case insensitively
NORM_IGNORENONSPACEIgnore nonspacing characters
NORM_IGNORESYMBOLSIgnore symbols
NORM_IGNOREWIDTHIgnore string width
NORM_IGNOREKANATYPEIgnore Kana type
NORM_IGNOREKASHIDAIgnore Arabic kashida characters

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns one of the following:

valuemeaning
VARCMP_LTleft is less than right
VARCMP_EQleft is equal to right
VARCMP_GTleft is greater than right
VARCMP_NULLEither left, right or both are NULL

variant_date_from_timestamp

Returns a variant date representation of a Unix timestamp

说明

variant variant_date_from_timestamp ( int $timestamp )

Converts timestamp from a unix timestamp value into a variant of type VT_DATE. This allows easier interopability between the unix-ish parts of PHP and COM.

参数

timestamp
A unix timestamp.

返回值

Returns a VT_DATE variant.

参见

  • variant_date_to_timestamp
  • mktime
  • time

variant_date_to_timestamp

Converts a variant date/time value to Unix timestamp

说明

int variant_date_to_timestamp ( variant $variant )

Converts variant from a VT_DATE (or similar) value into a Unix timestamp. This allows easier interopability between the Unix-ish parts of PHP and COM.

参数

variant
The variant.

返回值

Returns a unix timestamp.

参见

  • variant_date_from_timestamp
  • date
  • strftime

variant_div

Returns the result from dividing two variants

说明

variant variant_div ( mixed $left , mixed $right )

Divides left by right and returns the result.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">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 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

错误/异常

Throws a com_exception on failure.

参见

  • variant_idiv

variant_eqv

Performs a bitwise equivalence on two variants

说明

variant variant_eqv ( mixed $left , mixed $right )

Performs a bitwise equivalence on two variants.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If each bit in left is equal to the corresponding bit in right then TRUE is returned, otherwise FALSE is returned.

错误/异常

Throws a com_exception on failure.

variant_fix

Returns the integer portion of a variant

说明

variant variant_fix ( mixed $variant )

Gets the integer portion of a variant.

参数

variant
The variant.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If variant is negative, then the first negative integer greater than or equal to the variant is returned, otherwise returns the integer portion of the value of variant.

错误/异常

Throws a com_exception on failure.

注释

Warning

This documentation is based on the MSDN documentation; it appears that this function is either the same as variant_int, or that there is an error in the MSDN documentation.

参见

  • variant_int
  • variant_round
  • floor
  • ceil
  • round

variant_get_type

Returns the type of a variant object

说明

int variant_get_type ( variant $variant )

Returns the type of a variant object.

参数

variant
The variant object.

返回值

This function returns an integer value that indicates the type of variant, which can be an instance of com, dotnet or variant classes. The return value can be compared to one of the VT_XXX constants.

The return value for COM and DOTNET objects will usually be VT_DISPATCH; the only reason this function works for those classes is because COM and DOTNET are descendants of VARIANT.

参见

  • variant_set_type

variant_idiv

Converts variants to integers and then returns the result from dividing them

说明

variant variant_idiv ( mixed $left , mixed $right )

Converts left and right to integer values, and then performs integer division.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

IfThen
Both expressions are of the string, date, character, boolean typeDivision and integer is returned
One expression is a string type and the other a characterDivision
One expression is numeric and the other is a stringDivision
Both expressions are numericDivision
Either expression is NULLNULL is returned
Both expressions are emptyA com_exception with code DISP_E_DIVBYZERO is thrown

错误/异常

Throws a com_exception on failure.

参见

  • variant_div

variant_imp

Performs a bitwise implication on two variants

说明

variant variant_imp ( mixed $left , mixed $right )

Performs a bitwise implication operation.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If left isIf right isthen the result is
TRUETRUETRUE
TRUEFALSEFALSE
TRUENULLTRUE
FALSETRUETRUE
FALSEFALSETRUE
FALSENULLTRUE
NULLTRUETRUE
NULLFALSENULL
NULLNULLNULL

错误/异常

Throws a com_exception on failure.

variant_int

Returns the integer portion of a variant

说明

variant variant_int ( mixed $variant )

Gets the integer portion of a variant.

参数

variant
The variant.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If variant is negative, then the first negative integer greater than or equal to the variant is returned, otherwise returns the integer portion of the value of variant.

错误/异常

Throws a com_exception on failure.

参见

  • variant_fix
  • variant_round
  • floor
  • ceil
  • round

variant_mod

Divides two variants and returns only the remainder

说明

variant variant_mod ( mixed $left , mixed $right )

Divides left by right and returns the remainder.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the remainder of the division.

错误/异常

Throws a com_exception on failure.

参见

  • variant_div
  • variant_idiv

variant_mul

Multiplies the values of the two variants

说明

variant variant_mul ( mixed $left , mixed $right )

Multiplies left by right.

参数

left
The left operand.

right
The right operand.

Boolean values are converted to -1 for FALSE and 0 for TRUE.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

IfThen
Both expressions are of the string, date, character, boolean typeMultiplication
One expression is a string type and the other a characterMultiplication
One expression is numeric and the other is a stringMultiplication
Both expressions are numericMultiplication
Either expression is NULLNULL is returned
Both expressions are emptyEmpty string is returned

错误/异常

Throws a com_exception on failure.

参见

  • variant_div
  • variant_idiv

variant_neg

Performs logical negation on a variant

说明

variant variant_neg ( mixed $variant )

Performs logical negation of variant.

参数

variant
The variant.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the result of the logical negation.

错误/异常

Throws a com_exception on failure.

variant_not

Performs bitwise not negation on a variant

说明

variant variant_not ( mixed $variant )

Performs bitwise not negation on variant and returns the result.

参数

variant
The variant.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the bitwise not negation. If variant is NULL, the result will also be NULL.

错误/异常

Throws a com_exception on failure.

variant_or

Performs a logical disjunction on two variants

说明

variant variant_or ( mixed $left , mixed $right )

Performs a bitwise OR operation. Note that this is slightly different from a regular OR operation.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If left isIf right isthen the result is
TRUETRUETRUE
TRUEFALSETRUE
TRUENULLTRUE
FALSETRUETRUE
FALSEFALSEFALSE
FALSENULLNULL
NULLTRUETRUE
NULLFALSENULL
NULLNULLNULL

错误/异常

Throws a com_exception on failure.

参见

  • variant_and
  • variant_xor

variant_pow

Returns the result of performing the power function with two variants

说明

variant variant_pow ( mixed $left , mixed $right )

Returns the result of left to the power of right.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the result of left to the power of right.

错误/异常

Throws a com_exception on failure.

参见

  • pow

variant_round

Rounds a variant to the specified number of decimal places

说明

mixed variant_round ( mixed $variant , int $decimals )

Returns the value of variant rounded to decimals decimal places.

参数

variant
The variant.

decimals
Number of decimal places.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

Returns the rounded value.

参见

  • round

variant_set_type

Convert a variant into another type "in-place"

说明

void variant_set_type ( variant $variant , int $type )

This function is similar to variant_cast except that the variant is modified "in-place"; no new variant is created. The parameters for this function have identical meaning to those of variant_cast.

参数

variant
The variant.

type

返回值

没有返回值。

参见

  • variant_cast
  • variant_get_type

variant_set

Assigns a new value for a variant object

说明

void variant_set ( variant $variant , mixed $value )

Converts value to a variant and assigns it to the variant object; no new variant object is created, and the old value of variant is freed/released.

参数

variant
The variant.

value

返回值

没有返回值。

variant_sub

Subtracts the value of the right variant from the left variant value

说明

variant variant_sub ( mixed $left , mixed $right )

Subtracts right from left.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

IfThen
Both expressions are of the string typeSubtraction
One expression is a string type and the other a characterSubtraction
One expression is numeric and the other is a stringSubtraction.
Both expressions are numericSubtraction
Either expression is NULLNULL is returned
Both expressions are emptyEmpty string is returned

错误/异常

Throws a com_exception on failure.

参见

  • variant_add

variant_xor

Performs a logical exclusion on two variants

说明

variant variant_xor ( mixed $left , mixed $right )

Performs a logical exclusion.

参数

left
The left operand.

right
The right operand.

Note:

对于所有变量运算函数,本函数的参数可以是 PHP 内置的类型(整数,字符串,浮点数,布尔型或者 NULL),或者是一个 COM,VARIANT 或者 DOTNET 类的实例。PHP 内置类型将会使用和构造variant类相同的规则转换成变量。COM 和 DOTNET 对象的值将会取其默认属性并被当成变量值使用。

变量运算函数是同名函数在 COM 库中的外包;有关此类函数的更多信息参见 MSDN 库。PHP 函数命名有少许区别,例如 PHP 中的 class="function">variant_add 对应于 MSDN 文档中的 VarAdd()

返回值

If left isIf right isthen the result is
TRUETRUEFALSE
TRUEFALSETRUE
FALSETRUETRUE
FALSEFALSEFALSE
NULLNULLNULL

错误/异常

Throws a com_exception on failure.

参见

  • variant_or
  • variant_and

目录

  • com_create_guid — Generate a globally unique identifier (GUID)
  • com_event_sink — Connect events from a COM object to a PHP object
  • com_get_active_object — Returns a handle to an already running instance of a COM object
  • com_load_typelib — 装载一个 Typelib
  • com_message_pump — Process COM messages, sleeping for up to timeoutms milliseconds
  • com_print_typeinfo — Print out a PHP class definition for a dispatchable interface
  • variant_abs — Returns the absolute value of a variant
  • variant_add — "Adds" two variant values together and returns the result
  • variant_and — Performs a bitwise AND operation between two variants
  • variant_cast — Convert a variant into a new variant object of another type
  • variant_cat — Concatenates two variant values together and returns the result
  • variant_cmp — Compares two variants
  • variant_date_from_timestamp — Returns a variant date representation of a Unix timestamp
  • variant_date_to_timestamp — Converts a variant date/time value to Unix timestamp
  • variant_div — Returns the result from dividing two variants
  • variant_eqv — Performs a bitwise equivalence on two variants
  • variant_fix — Returns the integer portion of a variant
  • variant_get_type — Returns the type of a variant object
  • variant_idiv — Converts variants to integers and then returns the result from dividing them
  • variant_imp — Performs a bitwise implication on two variants
  • variant_int — Returns the integer portion of a variant
  • variant_mod — Divides two variants and returns only the remainder
  • variant_mul — Multiplies the values of the two variants
  • variant_neg — Performs logical negation on a variant
  • variant_not — Performs bitwise not negation on a variant
  • variant_or — Performs a logical disjunction on two variants
  • variant_pow — Returns the result of performing the power function with two variants
  • variant_round — Rounds a variant to the specified number of decimal places
  • variant_set_type — Convert a variant into another type "in-place"
  • variant_set — Assigns a new value for a variant object
  • variant_sub — Subtracts the value of the right variant from the left variant value
  • variant_xor — Performs a logical exclusion on two variants