(PHP 5, PHP 7, PHP 8)
variant_cmp — Compares two variants
$left,$right,$locale_id = LOCALE_SYSTEM_DEFAULT,$flags = 0
Compares left with right.
This function will only compare scalar values, not arrays or variant records.
leftThe left operand.
rightThe right operand.
locale_idA 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:
| 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 |
Nota:
Al igual que con todas las funciones aritméticas variantes, los parámetros de esta función pueden ser tanto un tipo nativo de PHP (integer, string, de punto flotante, boolean o
null), o una instancia de una clase COM, VARIANT o DOTNET. Los tipos nativos de PHP serán convertidos en variantes usando las mismas reglas tal como se encuentran en el constructor para la clase variant. Los objetos COM y DOTNET tomarán el valor de sus propiedades predeterminadas adoptadas y lo utilizarán como el valor variante.Las funciones aritméticas variantes son wrappers alrededor de las funciones con nombres similares en la librería COM; para más información sobre estas funciones, consulte la librería MSDN. Las funciones de PHP tienen nombres ligeramente diferentes; por ejemplo, variant_add() en PHP corresponde a
VarAdd()en la documentación MSDN.
Returns one of the following:
| 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
|