mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

We also document the new `$filter` parameter for the `ReflectionClass` methods `::getConstants()` and `::getReflectionConstants()` and the respective constants. Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de> Closes GH-298.
84 lines
2.1 KiB
XML
84 lines
2.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="reflectionreference.getid" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>ReflectionReference::getId</refname>
|
|
<refpurpose>Get unique ID of a reference</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>string</type><methodname>ReflectionReference::getId</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns an ID which is unique for the reference for the lifetime of that reference.
|
|
This ID can be used to compare references for equality, or to maintain a map of
|
|
known references.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
&no.function.parameters;
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns a &string; of unspecified format.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="reflectionreference.getid.example.basic">
|
|
<title>Basic <methodname>ReflectionReference::getId</methodname> usage</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$val1 = 'foo';
|
|
$val2 = 'bar';
|
|
$arr = [&$val1, &$val2, &$val1];
|
|
|
|
$rr1 = ReflectionReference::fromArrayElement($arr, 0);
|
|
$rr2 = ReflectionReference::fromArrayElement($arr, 1);
|
|
$rr3 = ReflectionReference::fromArrayElement($arr, 2);
|
|
|
|
var_dump($rr1->getId() === $rr2->getId());
|
|
var_dump($rr1->getId() === $rr3->getId());
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
bool(false)
|
|
bool(true)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|