php8.5
Home/ Manual/ com / functions/ variant_cmp

variant_cmp

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Compares two variants

Description

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.

Parameters

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:

valuemeaning
NORM_IGNORECASECompare case insensitively
NORM_IGNORENONSPACEIgnore nonspacing characters
NORM_IGNORESYMBOLSIgnore symbols
NORM_IGNOREWIDTHIgnore string width
NORM_IGNOREKANATYPEIgnore Kana type
NORM_IGNOREKASHIDAIgnore Arabic kashida characters

Variant-arith

Return Values

Returns one of the following:

valuemeaning
VARCMP_LTleft is less than right
VARCMP_EQleft is equal to right
VARCMP_GTleft is greater than right
VARCMP_NULLEither left, right or both are null

Source: reference/com/functions/variant-cmp.xml · from the official PHP manual (php/doc-en)