PHP 8.3.4 Released!

variant_cmp

(PHP 5, PHP 7, PHP 8)

variant_cmpCompares two variants

Descripción

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.

Parámetros

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

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.

Valores devueltos

Returns one of the following:

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

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top