1
0
mirror of https://github.com/php/doc-ja.git synced 2026-04-29 02:53:11 +02:00
Files

113 lines
3.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: f7e42edba898d3a07f5213360e9464fbf526b20e Maintainer: takagi Status: ready -->
<!-- CREDITS: shimooka -->
<refentry xml:id="function.spl-object-hash" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>spl_object_hash</refname>
<refpurpose>
指定したオブジェクトのハッシュ ID を返す
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>spl_object_hash</methodname>
<methodparam><type>object</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、オブジェクトの一意な識別子を返します。この ID は、
オブジェクトを保存する際のハッシュのキーとして使えます。
また、オブジェクトが破棄されるまでは、オブジェクトを識別するための値としても使えます。
オブジェクトが破棄されると、そのハッシュが他のオブジェクトで再利用されてしまうことがあります。
この振る舞いは、<function>spl_object_id</function> に似ています。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
何らかのオブジェクト。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
現在存在する各オブジェクトに固有で、同一オブジェクトに対しては常に同じ値となる文字列を返します。
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>spl_object_hash</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$id = spl_object_hash($object);
$storage[$id] = $object;
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
オブジェクトが破壊されるとき、そのハッシュが他のオブジェクトで再利用されてしまうことがあります。
</para>
</note>
<note>
<para>
オブジェクトの ハッシュID は、<code>===</code><code>!==</code>
を使って比較すべきです。なぜなら、この関数が返すハッシュID が
<link linkend="language.types.numeric-strings">数値形式の文字列</link>
になる可能性があるからです。
たとえば以下のような値がありえます: <literal>0000000000000e600000000000000000</literal>
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>spl_object_id</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->