<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.funchand.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.register-tick-function.php',
    1 => 'register_tick_function',
    2 => 'Registra una funci&oacute;n ejecutada en cada tick',
  ),
  'up' => 
  array (
    0 => 'ref.funchand.php',
    1 => 'Funciones de Manejo de Funciones',
  ),
  'prev' => 
  array (
    0 => 'function.register-shutdown-function.php',
    1 => 'register_shutdown_function',
  ),
  'next' => 
  array (
    0 => 'function.unregister-tick-function.php',
    1 => 'unregister_tick_function',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/funchand/functions/register-tick-function.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.register-tick-function" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">register_tick_function</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.3, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">register_tick_function</span> &mdash; <span class="dc-title">Registra una función ejecutada en cada tick</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.register-tick-function-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">function</span> <span class="methodname"><strong>register_tick_function</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">...$args</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   <span class="function"><strong>register_tick_function()</strong></span> registra la
   función <code class="parameter">callback</code> para ser ejecutada
   cada vez que ocurre un
   <a href="control-structures.declare.php#control-structures.declare.ticks" class="link">tick</a>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.register-tick-function-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">callback</code></dt>
     <dd>
      <p class="para">
       La función a registrar.
      </p>
     </dd>
    
    
     <dt><code class="parameter">args</code></dt>
     <dd>
      <p class="para">
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.register-tick-function-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Esta función retorna <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en caso de éxito o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si ocurre un error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.register-tick-function-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.5.0</td>
      <td>
       Los manejadores de tick ahora se desactivan más tarde durante el cierre
       de la petición: después de que se hayan ejecutado todas las funciones de
       cierre y los destructores, y después de que se hayan limpiado los
       manejadores de salida. Anteriormente se desactivaban al comienzo mismo
       del cierre de la petición, por lo que las funciones de tick ya no se
       llamaban durante las funciones de cierre, los destructores ni el
       tratamiento de la salida. Consulte la
       <a href="migration85.incompatible.php#migration85.incompatible.core.tick-handlers" class="link">guía de
       migración</a> para más detalles.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.register-tick-function-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplo con <span class="function"><strong>register_tick_function()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
</span><span style="color: #007700">declare(</span><span style="color: #0000BB">ticks</span><span style="color: #007700">=</span><span style="color: #0000BB">1</span><span style="color: #007700">);

function </span><span style="color: #0000BB">my_tick_function</span><span style="color: #007700">(</span><span style="color: #0000BB">$param</span><span style="color: #007700">) {
    echo </span><span style="color: #DD0000">"Función de retorno tick llamada con el parámetro: </span><span style="color: #0000BB">$param</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;
}

</span><span style="color: #0000BB">register_tick_function</span><span style="color: #007700">(</span><span style="color: #DD0000">'my_tick_function'</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.register-tick-function-seealso">
  <h3 class="title">Véase también</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="control-structures.declare.php" class="link">declare</a></li>
    <li><span class="function"><a href="function.unregister-tick-function.php" class="function" rel="rdfs-seeAlso">unregister_tick_function()</a> - Anula la funci&oacute;n ejecutada en cada tick</span></li>
   </ul>
  </p>
 </div>


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