<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.phptoken.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'phptoken.is.php',
    1 => 'PhpToken::is',
    2 => 'Indica si el token es de un tipo dado.',
  ),
  'up' => 
  array (
    0 => 'class.phptoken.php',
    1 => 'PhpToken',
  ),
  'prev' => 
  array (
    0 => 'phptoken.gettokenname.php',
    1 => 'PhpToken::getTokenName',
  ),
  'next' => 
  array (
    0 => 'phptoken.isignorable.php',
    1 => 'PhpToken::isIgnorable',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/tokenizer/phptoken/is.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="phptoken.is" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PhpToken::is</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">PhpToken::is</span> &mdash; <span class="dc-title">Indica si el token es de un tipo dado.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-phptoken.is-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>PhpToken::is</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.array.php" class="type array">array</a></span></span> <code class="parameter">$kind</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Indica si el token es de un tipo (<code class="parameter">kind</code>) dado.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-phptoken.is-parameters">
  <h3 class="title">Parámetros</h3>
  <dl>
   
     <dt><code class="parameter">kind</code></dt>
     <dd>
      <p class="para">
       Un valor único para coincidir con el id o el contenido textual del token, o un array de estos valores.
      </p>
     </dd>
    
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-phptoken.is-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Un valor bool que indica si el token es del tipo dado.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-phptoken.is-examples">
  <h3 class="title">Ejemplos</h3>
  <div class="example" id="example-1">
   <p><strong>Ejemplo #1 Ejemplo de<span class="function"><strong>PhpToken::is()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$token </span><span style="color: #007700">= new </span><span style="color: #0000BB">PhpToken</span><span style="color: #007700">(</span><span style="color: #0000BB">T_ECHO</span><span style="color: #007700">, </span><span style="color: #DD0000">'echo'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$token</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">is</span><span style="color: #007700">(</span><span style="color: #0000BB">T_ECHO</span><span style="color: #007700">));        </span><span style="color: #FF8000">// -&gt; bool(true)<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$token</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">is</span><span style="color: #007700">(</span><span style="color: #DD0000">'echo'</span><span style="color: #007700">));        </span><span style="color: #FF8000">// -&gt; bool(true)<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$token</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">is</span><span style="color: #007700">(</span><span style="color: #0000BB">T_FOREACH</span><span style="color: #007700">));     </span><span style="color: #FF8000">// -&gt; bool(false)<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$token</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">is</span><span style="color: #007700">(</span><span style="color: #DD0000">'foreach'</span><span style="color: #007700">));     </span><span style="color: #FF8000">// -&gt; bool(false)</span></span></code></div>
   </div>

  </div>
  <div class="example" id="example-2">
   <p><strong>Ejemplo #2 Uso con array</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">isClassType</span><span style="color: #007700">(</span><span style="color: #0000BB">PhpToken $token</span><span style="color: #007700">): </span><span style="color: #0000BB">bool </span><span style="color: #007700">{<br />    return </span><span style="color: #0000BB">$token</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">is</span><span style="color: #007700">([</span><span style="color: #0000BB">T_CLASS</span><span style="color: #007700">, </span><span style="color: #0000BB">T_INTERFACE</span><span style="color: #007700">, </span><span style="color: #0000BB">T_TRAIT</span><span style="color: #007700">]);<br />}<br /><br /></span><span style="color: #0000BB">$interface </span><span style="color: #007700">= new </span><span style="color: #0000BB">PhpToken</span><span style="color: #007700">(</span><span style="color: #0000BB">T_INTERFACE</span><span style="color: #007700">, </span><span style="color: #DD0000">'interface'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">isClassType</span><span style="color: #007700">(</span><span style="color: #0000BB">$interface</span><span style="color: #007700">));   </span><span style="color: #FF8000">// -&gt; bool(true)<br /><br /></span><span style="color: #0000BB">$function </span><span style="color: #007700">= new </span><span style="color: #0000BB">PhpToken</span><span style="color: #007700">(</span><span style="color: #0000BB">T_FUNCTION</span><span style="color: #007700">, </span><span style="color: #DD0000">'function'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">isClassType</span><span style="color: #007700">(</span><span style="color: #0000BB">$function</span><span style="color: #007700">));    </span><span style="color: #FF8000">// -&gt; bool(false)</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-phptoken.is-seealso">
  <h3 class="title">Ver también</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.token-name.php" class="function" rel="rdfs-seeAlso">token_name()</a> - Obtiene el nombre simb&oacute;lico de un token PHP dado</span></li>
  </ul>
 </div>

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