<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.spl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.spl-object-hash.php',
    1 => 'spl_object_hash',
    2 => 'Devuelve el identificador de hash para un objeto dado',
  ),
  'up' => 
  array (
    0 => 'ref.spl.php',
    1 => 'Funciones SPL',
  ),
  'prev' => 
  array (
    0 => 'function.spl-classes.php',
    1 => 'spl_classes',
  ),
  'next' => 
  array (
    0 => 'function.spl-object-id.php',
    1 => 'spl_object_id',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/spl/functions/spl-object-hash.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.spl-object-hash" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">spl_object_hash</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">spl_object_hash</span> &mdash; <span class="dc-title">
   Devuelve el identificador de hash para un objeto dado
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.spl-object-hash-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>spl_object_hash</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.object.php" class="type object">object</a></span> <code class="parameter">$object</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Esta función devuelve un identificador único para el objeto. Este identificador
   puede ser utilizado como clave de hash para almacenar los objetos o para identificarlos,
   mientras el objeto no sea destruido. Una vez destruido el objeto,
   el identificador puede ser reutilizado para otros objetos. Este comportamiento es similar al de la <span class="function"><a href="function.spl-object-id.php" class="function">spl_object_id()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.spl-object-hash-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">object</code></dt>
     <dd>
      <p class="para">
       Cualquier objeto.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.spl-object-hash-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Un <span class="type"><a href="language.types.string.php" class="type string">string</a></span> único para cada objeto existente y que
   será siempre idéntico para cada objeto.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.spl-object-hash-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>spl_object_hash()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$id </span><span style="color: #007700">= </span><span style="color: #0000BB">spl_object_hash</span><span style="color: #007700">(</span><span style="color: #0000BB">$object</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$storage</span><span style="color: #007700">[</span><span style="color: #0000BB">$id</span><span style="color: #007700">] = </span><span style="color: #0000BB">$object</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 notes" id="refsect1-function.spl-object-hash-notes">
  <h3 class="title">Notas</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Cuando un objeto es destruido, su identificador de hash
    podrá ser reutilizado para otros objetos.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Los hash de objeto deben ser comparados por su identidad con <code class="code">===</code>
    y <code class="code">!==</code>, ya que el hash devuelto podría ser
    una <a href="language.types.numeric-strings.php" class="link">cadena numérica</a>.
    Por ejemplo: <code class="literal">0000000000000e600000000000000000</code>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.spl-object-hash-seealso">
  <h3 class="title">Ver también</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.spl-object-id.php" class="function" rel="rdfs-seeAlso">spl_object_id()</a> - Devuelve el gestor de objeto entero para un objeto dado</span></li>
   </ul>
  </p>
 </div>


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