Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions reference/spl/splobjectstorage/attach.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<methodparam choice="opt"><type>mixed</type><parameter>info</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Adds an <type>object</type> inside the storage, and optionally associate it to some data.
Adds an <parameter>object</parameter> inside the storage, and optionally associate it to some data.
</para>
</refsect1>

Expand All @@ -31,15 +31,15 @@
<term><parameter>object</parameter></term>
<listitem>
<para>
The <type>object</type> to add.
The <parameter>object</parameter> to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
The data to associate with the <type>object</type>.
The data to associate with the <parameter>object</parameter>.
</para>
</listitem>
</varlistentry>
Expand All @@ -62,11 +62,12 @@
<programlisting role="php">
<![CDATA[
<?php
$o1 = new stdClass;
$o2 = new stdClass;

$o1 = new stdClass();
$o2 = new stdClass();
$s = new SplObjectStorage();
$s->attach($o1); // similar to $s[$o1] = NULL;
$s->attach($o2, "hello"); // similar to $s[$o2] = "hello";
$s->attach($o1); // Similar to $s[$o1] = NULL;
$s->attach($o2, "hello"); // Similar to $s[$o2] = "hello";

var_dump($s[$o1]);
var_dump($s[$o2]);
Expand Down
10 changes: 6 additions & 4 deletions reference/spl/splobjectstorage/contains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<methodparam><type>object</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
Checks if the storage contains the <type>object</type> provided.
Checks if the storage contains the <parameter>object</parameter> provided.
</para>
</refsect1>

Expand All @@ -30,7 +30,7 @@
<term><parameter>object</parameter></term>
<listitem>
<para>
The <type>object</type> to look for.
The <parameter>object</parameter> to look for.
</para>
</listitem>
</varlistentry>
Expand All @@ -53,14 +53,16 @@
<programlisting role="php">
<![CDATA[
<?php
$o1 = new stdClass;
$o2 = new stdClass;

$o1 = new stdClass();
$o2 = new stdClass();

$s = new SplObjectStorage();

$s[$o1] = "hello";
var_dump($s->contains($o1));
var_dump($s->contains($o2));

?>
]]>
</programlisting>
Expand Down
10 changes: 7 additions & 3 deletions reference/spl/splobjectstorage/detach.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<methodparam><type>object</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
Removes the <type>object</type> from the storage.
Removes the <parameter>object</parameter> from the storage.
</para>
</refsect1>

Expand All @@ -30,7 +30,7 @@
<term><parameter>object</parameter></term>
<listitem>
<para>
The <type>object</type> to remove.
The <parameter>object</parameter> to remove.
</para>
</listitem>
</varlistentry>
Expand All @@ -53,12 +53,16 @@
<programlisting role="php">
<![CDATA[
<?php
$o = new stdClass;

$o = new stdClass();
$s = new SplObjectStorage();

$s->attach($o);
var_dump(count($s));

$s->detach($o);
var_dump(count($s));

?>
]]>
</programlisting>
Expand Down