Description
int
variant_cmp ( mixed left, mixed right [, int lcid [, int flags]] )
Compares left with right
and returns one of the following values:
表格 1. 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:
表格 2. 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 |
注:
對於所有的變量算法函數,此函數的參數可以要麼是 PHP
自身的類型(整型,字串,浮點型,布爾型或是
NULL),要麼是一個 COM,VARIANT 或 DOTNET 類的案例。PHP
自身類型將被轉換為變量,使用與 VARIANT
類的構造函數中相同的規則。COM 和 DOTNET 物件將具有其預設屬性的值,取得並作為變量值使用。
變量算法函數是 COM 庫中與其名稱接近的函數的封裝。此類函數的更多訊息請參考
MSDN 庫。PHP 函數命名有少許不同,例如 PHP 中的
variant_add() 對應於 MSDN 文件中的 VarAdd()。