variant_cmp
(PHP 5)
variant_cmp —
Compares two variants
Description
int variant_cmp
( mixed $left
, mixed $right
[, int $lcid
[, int $flags
]] )
Compares left
with right
and returns one of the following values:
Variant Comparision Results
value |
meaning |
VARCMP_LT |
left
is less than
right
|
VARCMP_EQ |
left
is equal to
right
|
VARCMP_GT |
left
is greater than
right
|
VARCMP_NULL |
Either left
,
right
or both are NULL
|
This function will only compare scalar values, not arrays or variant records.
lcid
is a valid Locale Identifier to use when
comparing strings (this affects string collation).
flags
can be one or more of the following values
OR'd together, and affects string comparisons:
Variant Comparision Flags
value |
meaning |
NORM_IGNORECASE |
Compare case insensitively |
NORM_IGNORENONSPACE |
Ignore nonspacing characters |
NORM_IGNORESYMBOLS |
Ignore symbols |
NORM_IGNOREWIDTH |
Ignore string width |
NORM_IGNOREKANATYPE |
Ignore Kana type |
NORM_IGNOREKASHIDA |
Ignore Arabic kashida characters |
Note:
对于所有的变量算法函数,此函数的参数可以要么是 PHP
自身的类型(整型,字符串,浮点型,布尔型或者
NULL),要么是一个 COM,VARIANT 或 DOTNET 类的实例。PHP
自身类型将被转换为变量,使用与 VARIANT
类的构造函数中相同的规则。COM 和 DOTNET 对象将具有其默认属性的值,取得并作为变量值使用。
变量算法函数是 COM 库中与其名称接近的函数的封装。此类函数的更多信息请参考
MSDN 库。PHP 函数命名有少许不同,例如 PHP 中的
variant_add() 对应于 MSDN 文档中的 VarAdd()。