philip Wed Mar 27 19:26:20 2002 EDT
Modified files:
/phpdoc/en/functions array.xml
Log:
list: Added more examples, which demonstrate ,,, syntax
See also extract()
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.169 phpdoc/en/functions/array.xml:1.170
--- phpdoc/en/functions/array.xml:1.169 Wed Mar 27 18:55:32 2002
+++ phpdoc/en/functions/array.xml Wed Mar 27 19:26:19 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.169 $ -->
+<!-- $Revision: 1.170 $ -->
<reference id="ref.array">
<title>Array Functions</title>
<titleabbrev>Arrays</titleabbrev>
@@ -3127,8 +3127,36 @@
Like <function>array</function>, this is not really a function,
but a language construct. <function>list</function> is used to
assign a list of variables in one operation.
+ </para>
+ <para>
+ <example>
+ <title><function>list</function> examples</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$info = array('coffee', 'brown', 'caffeine');
+
+// Listing all the variables
+list($drink, $color, $power) = $info;
+print "$drink is $color and $power makes it special.\n";
+
+// Listing some of them
+list($drink, , $power) = $info;
+print "$drink has $power.\n";
+
+// Or let's skip to only the third one
+list( , , $power) = $info;
+print "I need $power!\n";
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
<example>
- <title><function>list</function> example</title>
+ <title>An example use of <function>list</function></title>
<programlisting role="php">
<![CDATA[
<table>
@@ -3155,7 +3183,8 @@
</example>
</para>
<para>
- See also <function>each</function> and <function>array</function>.
+ See also <function>each</function>, <function>array</function>
+ and <function>extract</function>.
</para>
</refsect1>
</refentry>