CakeFest 2024: The Official CakePHP Conference

variant_cmp

(PHP 5, PHP 7, PHP 8)

variant_cmpCompares two variants

Descrição

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:

Assim como todas as funções aritméticas variantes, os parâmetros para esta função podem ser um tipo nativo do PHP (inteiro, string, ponto flutuante, booleano ou null) ou uma instância de uma classe COM, VARIANT ou DOTNET. Tipos nativos do PHP serão convertidos em variantes usando as mesmas regras encontradas no construtor da classe variant. Objetos COM e DOTNET terão o valor de sua propriedade padrão obtido e usado como o valor da variante.

As funções aritméticas variantes são wrappers para funções com nomes semelhantes na biblioteca COM; para mais informações sobre estas funções, consulte a biblioteca MSDN. As funções do PHP são nomeadas de forma ligeiramente diferente; por exemplo, variant_add() no PHP corresponde a VarAdd() na documentação da MSDN.

Valor Retornado

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