Php/docs/function.variant-cmp
variant_cmp
(PHP 5, PHP 7)
variant_cmp — Compares two variants
说明
variant_cmp
( mixed $left
, mixed $right
[, int $locale_id
= LOCALE_SYSTEM_DEFAULT
[, int $flags
= 0
]] ) : int
Compares left
with right
.
This function will only compare scalar values, not arrays or variant records.
参数
left
The left operand.
right
The right operand.
locale_id
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: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()
。
返回值
Returns one of the following:
value | meaning |
---|---|
VARCMP_LT
|
left is less than
|
VARCMP_EQ
|
left is equal to
|
VARCMP_GT
|
left is greater than
|
VARCMP_NULL
|
Either left ,
|