upgrade example

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@115029 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Damien Seguy 2003-02-07 05:07:51 +00:00
parent 128fc6f3e7
commit ef729dd9f6
2 changed files with 63 additions and 19 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.14 -->
<refentry id="function.array-splice">
<refnamediv>
@ -61,16 +61,53 @@
</para>
<para>
The following equivalences hold:
<programlisting role="php">
<![CDATA[
array_push ($input, $x, $y) array_splice ($input, count ($input), 0,
array ($x, $y))
array_pop ($input) array_splice ($input, -1)
array_shift ($input) array_splice ($input, 0, 1)
array_unshift ($input, $x, $y) array_splice ($input, 0, 0, array ($x, $y))
$input[$x] = $y array_splice ($input, $x, 1, $y)
]]>
</programlisting>
<table>
<title><function>array_splice</function> equivalents</title>
<tgroup cols="2">
<tbody>
<row>
<entry>
array_push($input, $x, $y)
</entry>
<entry>
array_splice($input, count($input), 0, array($x, $y))
</entry>
</row>
<row>
<entry>
array_pop($input)
</entry>
<entry>
array_splice($input, -1)
</entry>
</row>
<row>
<entry>
array_shift($input)
</entry>
<entry>
array_splice($input, -1)
</entry>
</row>
<row>
<entry>
array_unshift($input, $x, $y)
</entry>
<entry>
array_splice($input, 0, 0, array($x, $y))
</entry>
</row>
<row>
<entry>
$a[$x] = $y
</entry>
<entry>
array_splice($input, $x, 1, $y)
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
Returns the array consisting of removed elements.

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
<refentry id="function.array-unique">
<refnamediv>
@ -43,9 +43,13 @@
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
print_r($result);
/* Which outputs:
?>
]]>
</programlisting>
<para>
Cela va afficher :
<screen role="php">
<![CDATA[
Array
(
[a] => green
@ -67,14 +71,17 @@ Array
$input = array (4,"4","3",4,3,"3");
$result = array_unique ($input);
var_dump($result);
/* Which outputs:
?>
]]>
</programlisting>
<para>
This script will output:
<screen role="php">
<![CDATA[
array(2) {
[0] => int(4)
[2] => string(1) "3"
}
*/
?>
]]>
</programlisting>