<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.var.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.gettype.php',
    1 => 'gettype',
    2 => 'Liefert den Datentyp einer Variablen',
  ),
  'up' => 
  array (
    0 => 'ref.var.php',
    1 => 'Funktionen zur Behandlung von Variablen',
  ),
  'prev' => 
  array (
    0 => 'function.get-resource-type.php',
    1 => 'get_resource_type',
  ),
  'next' => 
  array (
    0 => 'function.intval.php',
    1 => 'intval',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/var/functions/gettype.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.gettype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gettype</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">gettype</span> &mdash; <span class="dc-title">Liefert den Datentyp einer Variablen</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.gettype-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>gettype</strong></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>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Liefert den Datentyp der Variablen <code class="parameter">value</code>. Zur
   Typprüfung sollten die <code class="literal">is_*</code> Funktionen verwendet
   werden.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.gettype-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       Die Variable, deren Typ ermittelt werden soll.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.gettype-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Mögliche Werte der zurückgegebenen Zeichenkette sind:
   <ul class="simplelist">
    <li>
     <code class="literal">&quot;boolean&quot;</code>
    </li>
    <li>
     <code class="literal">&quot;integer&quot;</code>
    </li>
    <li>
     <span class="type">"double"</span> (aus historischen Gründen wird
     <code class="literal">&quot;double&quot;</code> im Fall eines <span class="type"><a href="language.types.float.php" class="type float">float</a></span>
     zurückgegeben, und nicht einfach <span class="type"><a href="language.types.float.php" class="type float">float</a></span>.
    </li>
    <li>
     <code class="literal">&quot;string&quot;</code>
    </li>
    <li>
     <code class="literal">&quot;array&quot;</code>
    </li>
    <li>
     <code class="literal">&quot;object&quot;</code>
    </li>
    <li>
     <code class="literal">&quot;resource&quot;</code>
    </li>
    <li>
     <code class="literal">&quot;resource (closed)&quot;</code> von PHP 7.2.0 an.
    </li>
    <li>
     <code class="literal">&quot;NULL&quot;</code>
    </li>
    <li>
     <code class="literal">&quot;unknown type&quot;</code>
    </li>
   </ul>
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.gettype-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Beschreibung</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.2.0</td>
       <td>
        Geschlossene Ressourcen werden nun als <code class="literal">&#039;resource
        (closed)&#039;</code>
        gemeldet. Zuvor war der Rückgabewert für geschlossene Ressourcen
        <code class="literal">&#039;unknown type&#039;</code>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gettype-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>gettype()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$data </span><span style="color: #007700">= array(</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">1.</span><span style="color: #007700">, </span><span style="color: #0000BB">NULL</span><span style="color: #007700">, new </span><span style="color: #0000BB">stdClass</span><span style="color: #007700">, </span><span style="color: #DD0000">'foo'</span><span style="color: #007700">);<br /><br />foreach (</span><span style="color: #0000BB">$data </span><span style="color: #007700">as </span><span style="color: #0000BB">$value</span><span style="color: #007700">) {<br />    echo </span><span style="color: #0000BB">gettype</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">integer
double
NULL
object
string</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.gettype-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.get-debug-type.php" class="function" rel="rdfs-seeAlso">get_debug_type()</a> - Gets the type name of a variable in a way that is suitable for debugging</span></li>
   <li><span class="function"><a href="function.settype.php" class="function" rel="rdfs-seeAlso">settype()</a> - Legt den Typ einer Variablen fest</span></li>
   <li><span class="function"><a href="function.get-class.php" class="function" rel="rdfs-seeAlso">get_class()</a> - Ermittelt den Klassennamen eines Objekts</span></li>
   <li><span class="function"><a href="function.is-array.php" class="function" rel="rdfs-seeAlso">is_array()</a> - Pr&uuml;ft, ob die Variable ein Array ist</span></li>
   <li><span class="function"><a href="function.is-bool.php" class="function" rel="rdfs-seeAlso">is_bool()</a> - Pr&uuml;ft, ob eine Variable vom Typ boolean ist</span></li>
   <li><span class="function"><a href="function.is-callable.php" class="function" rel="rdfs-seeAlso">is_callable()</a> - Pr&uuml;ft, ob ein Wert als Funktion aus dem aktuellen Bereich aufgerufen werden kann.</span></li>
   <li><span class="function"><a href="function.is-float.php" class="function" rel="rdfs-seeAlso">is_float()</a> - Pr&uuml;ft, ob eine Variable vom Typ float ist</span></li>
   <li><span class="function"><a href="function.is-int.php" class="function" rel="rdfs-seeAlso">is_int()</a> - Pr&uuml;ft, ob eine Variable vom Typ int ist</span></li>
   <li><span class="function"><a href="function.is-null.php" class="function" rel="rdfs-seeAlso">is_null()</a> - Pr&uuml;ft, ob eine Variable null enth&auml;lt</span></li>
   <li><span class="function"><a href="function.is-numeric.php" class="function" rel="rdfs-seeAlso">is_numeric()</a> - Pr&uuml;ft, ob eine Variable eine Zahl oder ein numerischer String ist</span></li>
   <li><span class="function"><a href="function.is-object.php" class="function" rel="rdfs-seeAlso">is_object()</a> - Pr&uuml;ft, ob eine Variable vom Typ object ist</span></li>
   <li><span class="function"><a href="function.is-resource.php" class="function" rel="rdfs-seeAlso">is_resource()</a> - Pr&uuml;ft, ob eine Variable vom Typ resource ist</span></li>
   <li><span class="function"><a href="function.is-scalar.php" class="function" rel="rdfs-seeAlso">is_scalar()</a> - Pr&uuml;ft, ob eine Variable skalar ist</span></li>
   <li><span class="function"><a href="function.is-string.php" class="function" rel="rdfs-seeAlso">is_string()</a> - Pr&uuml;ft, ob Variable vom Typ string ist</span></li>
   <li><span class="function"><a href="function.function-exists.php" class="function" rel="rdfs-seeAlso">function_exists()</a> - Falls die angegebene Funktion definiert ist, wird true zur&uuml;ck
   gegeben</span></li>
   <li><span class="function"><a href="function.method-exists.php" class="function" rel="rdfs-seeAlso">method_exists()</a> - Pr&uuml;ft ob eine Methode innerhalb eines Objekts existiert</span></li>
   </ul>
  </p>
 </div>

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