<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.com.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.variant-cmp.php',
    1 => 'variant_cmp',
    2 => 'Compares two variants',
  ),
  'up' => 
  array (
    0 => 'ref.com.php',
    1 => 'COM Functions',
  ),
  'prev' => 
  array (
    0 => 'function.variant-cat.php',
    1 => 'variant_cat',
  ),
  'next' => 
  array (
    0 => 'function.variant-date-from-timestamp.php',
    1 => 'variant_date_from_timestamp',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/com/functions/variant-cmp.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.variant-cmp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">variant_cmp</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">variant_cmp</span> &mdash; <span class="dc-title">Compares two variants</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.variant-cmp-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>variant_cmp</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$left</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$right</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$locale_id</code><span class="initializer"> = <strong><code><a href="com.constants.php#constant.locale-system-default">LOCALE_SYSTEM_DEFAULT</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span><br>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   Compares <code class="parameter">left</code> with <code class="parameter">right</code>.
  </p>
  <p class="para">
   This function will only compare scalar values, not arrays or variant records.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.variant-cmp-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">left</code></dt>
     <dd>
      <p class="para">
       The left operand.
      </p>
     </dd>
    
    
     <dt><code class="parameter">right</code></dt>
     <dd>
      <p class="para">
       The right operand.
      </p>
     </dd>
    
    
     <dt><code class="parameter">locale_id</code></dt>
     <dd>
      <p class="para">
       A valid Locale Identifier to use when comparing strings (this affects
       string collation).
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">flags</code> can be one or more of the following values
       OR&#039;d together, and affects string comparisons:
       <table class="doctable table">
        <caption><strong>Variant Comparison Flags</strong></caption>
        
         <thead>
          <tr>
           <th>value</th>
           <th>meaning</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code><a href="com.constants.php#constant.norm-ignorecase">NORM_IGNORECASE</a></code></strong></td>
           <td>Compare case insensitively</td>
          </tr>

          <tr>
           <td><strong><code><a href="com.constants.php#constant.norm-ignorenonspace">NORM_IGNORENONSPACE</a></code></strong></td>
           <td>Ignore nonspacing characters</td>
          </tr>

          <tr>
           <td><strong><code><a href="com.constants.php#constant.norm-ignoresymbols">NORM_IGNORESYMBOLS</a></code></strong></td>
           <td>Ignore symbols</td>
          </tr>

          <tr>
           <td><strong><code><a href="com.constants.php#constant.norm-ignorewidth">NORM_IGNOREWIDTH</a></code></strong></td>
           <td>Ignore string width</td>
          </tr>

          <tr>
           <td><strong><code><a href="com.constants.php#constant.norm-ignorekanatype">NORM_IGNOREKANATYPE</a></code></strong></td>
           <td>Ignore Kana type</td>
          </tr>

          <tr>
           <td><strong><code><a href="com.constants.php#constant.norm-ignorekashida">NORM_IGNOREKASHIDA</a></code></strong></td>
           <td>Ignore Arabic kashida characters</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
   </dl>
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
<p class="para">
 As with all the variant arithmetic functions, the parameters for this function
 can be either a PHP native type (integer, string, floating point, boolean or
 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>), or an instance of a COM, VARIANT or DOTNET class.  PHP native types
 will be converted to variants using the same rules as found in the constructor
 for the <a href="class.variant.php" class="xref">variant</a> class.  COM and DOTNET objects
 will have the value of their default property taken and used as the variant value.
</p>
<p class="para">
 The variant arithmetic functions are wrappers around the similarly named
 functions in the COM library; for more information on these functions, consult
 the MSDN library.  The PHP functions are named slightly differently; for example
 <span class="function"><a href="function.variant-add.php" class="function">variant_add()</a></span> in PHP corresponds to <code class="literal">VarAdd()
 </code> in the MSDN documentation.
</p>
</p></blockquote>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.variant-cmp-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns one of the following:
   <table class="doctable table">
    <caption><strong>Variant Comparison Results</strong></caption>
    
     <thead>
      <tr>
       <th>value</th>
       <th>meaning</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><strong><code><a href="com.constants.php#constant.varcmp-lt">VARCMP_LT</a></code></strong></td>
       <td><code class="parameter">left</code> is less than
        <code class="parameter">right</code>
       </td>
      </tr>

      <tr>
       <td><strong><code><a href="com.constants.php#constant.varcmp-eq">VARCMP_EQ</a></code></strong></td>
       <td><code class="parameter">left</code> is equal to
        <code class="parameter">right</code>
       </td>
      </tr>

      <tr>
       <td><strong><code><a href="com.constants.php#constant.varcmp-gt">VARCMP_GT</a></code></strong></td>
       <td><code class="parameter">left</code> is greater than
        <code class="parameter">right</code>
       </td>
      </tr>

      <tr>
       <td><strong><code><a href="com.constants.php#constant.varcmp-null">VARCMP_NULL</a></code></strong></td>
       <td>Either <code class="parameter">left</code>,
        <code class="parameter">right</code> or both are <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

</div><?php manual_footer($setup); ?>