Fixing examples which almost closes bug #21920. Also, removing old 4.0.4

warning and some touchups.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@114858 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2003-02-05 08:21:21 +00:00
parent d577dbfb1e
commit b222a4c135

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
<refentry id="function.array-unique">
<refnamediv>
@ -29,41 +29,33 @@
Two elements are considered equal if and only if
<literal>(string) $elem1 === (string) $elem2</literal>. In words:
when the string representation is the same.
<!-- TODO: example of it... -->
</simpara>
<simpara>
The first element will be used.
</simpara>
</note>
<warning>
<simpara>
This was broken in PHP 4.0.4!
<!-- TODO: when exactly was this broken?... -->
</simpara>
</warning>
<para>
<example>
<title><function>array_unique</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
print_r($result);
]]>
</programlisting>
<para>
This will output:
<screen role="php">
<![CDATA[
/* Which outputs:
Array
(
[b] => green
[a] => green
[0] => red
[1] => blue
[2] => red
)
*/
?>
]]>
</screen>
</para>
</programlisting>
</example>
</para>
<para>
@ -71,24 +63,21 @@ Array
<title><function>array_unique</function> and types</title>
<programlisting role="php">
<![CDATA[
<?php
$input = array (4,"4","3",4,3,"3");
$result = array_unique ($input);
var_dump($result);
/* Which outputs:
array(2) {
[0] => int(4)
[2] => string(1) "3"
}
*/
?>
]]>
</programlisting>
<para>
The printout of the program above will be (PHP 4.0.6):
<screen role="php">
<![CDATA[
array(2) {
[3]=>
int(4)
[4]=>
int(3)
}
]]>
</screen>
</para>
</example>
</para>
</refsect1>