<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.com.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'class.variant.php',
    1 => 'variant',
    2 => 'Die Klasse variant',
  ),
  'up' => 
  array (
    0 => 'book.com.php',
    1 => 'COM',
  ),
  'prev' => 
  array (
    0 => 'dotnet.construct.php',
    1 => 'dotnet::__construct',
  ),
  'next' => 
  array (
    0 => 'variant.construct.php',
    1 => 'variant::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/com/variant.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.variant.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.variant" class="reference">
 
 <h1 class="title">Die Klasse variant</h1>
 <div class="partintro"><p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8)</p>


  <div class="section" id="variant.intro">
   <h2 class="title">Einführung</h2>
   <p class="para">
    VARIANT ist COMs Pendant von PHPs zval; es ist eine Struktur, die einen
    Wert einer Reihe unterschiedlicher möglicher Typen enthalten kann. Mit der
    Klasse variant, die von der Erweiterung COM zur Verfügung gestellt wird,
    kann die Art und Weise, wie PHP Werte an COM übergibt und von COM erhält,
    besser kontrolliert werden.
   </p>
  </div>


  <div class="section" id="variant.synopsis">
   <h2 class="title">Klassenbeschreibung</h2>


   <div class="classsynopsis"><div class="classsynopsisinfo">
    
     <span class="modifier">class</span> <strong class="classname"><strong class="classname">variant</strong></strong>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methoden */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="variant.construct.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$value</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$type</code><span class="initializer"> = <strong><code><a href="com.constants.php#constant.vt-empty">VT_EMPTY</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$codepage</code><span class="initializer"> = <strong><code><a href="com.constants.php#constant.cp-acp">CP_ACP</a></code></strong></span></span>)</div>

   }</div>


  </div>

  <div class="section" id="class.variant.examples">
   <h2 class="title">variant-Beispiele</h2>
   <p class="para">
    <div class="example" id="com.variant.example.php5">
     <p><strong>Beispiel #1 variant-Beispiel</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$v </span><span style="color: #007700">= new </span><span style="color: #0000BB">variant</span><span style="color: #007700">(</span><span style="color: #0000BB">42</span><span style="color: #007700">);<br />print </span><span style="color: #DD0000">"Der Typ ist " </span><span style="color: #007700">. </span><span style="color: #0000BB">variant_get_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$v</span><span style="color: #007700">) . </span><span style="color: #DD0000">"&lt;br/&gt;"</span><span style="color: #007700">;<br />print </span><span style="color: #DD0000">"Der Wert ist " </span><span style="color: #007700">. </span><span style="color: #0000BB">$v </span><span style="color: #007700">. </span><span style="color: #DD0000">"&lt;br/&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
   <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <p class="para">
     Wenn ein Wert zurückgegeben oder eine variant-Eigenschaft abgerufen wird,
     wird variant nur dann in einen PHP-Wert konvertiert, wenn es eine
     direkte, verlustlose Zuordnung zwischen den Typen gibt. In allen anderen
     Fällen wird das Ergebnis als Instanz der variant-Klasse zurückgegeben. Es
     ist möglich PHP zu zwingen, die Variante in einen nativen PHP-Typ zu
     konvertieren, entweder durch explizite Verwendung eines Operators für die
     Typumwandlung oder implizit durch die Umwandlung in einen String mittels
     <span class="function"><a href="function.print.php" class="function">print</a></span>. Die breite Palette von variant-Funktionen
     kann verwendet werden, um arithmetische Operationen auf Varianten
     durchzuführen, ohne eine Konvertierung zu erzwingen und damit
     Datenverlust zu riskieren.
    </p>
   </p></blockquote>
   <p class="para">
    Siehe auch <span class="function"><a href="function.variant-get-type.php" class="function">variant_get_type()</a></span>.
   </p>
  </div>

 </div>

 








<h2>Inhaltsverzeichnis</h2><ul class="chunklist chunklist_reference"><li><a href="variant.construct.php">variant::__construct</a> — Der variant-Klassenkonstruktor</li></ul>
</div>
<?php manual_footer($setup); ?>