cvs: phpdoc /en/language/types array.xml
| From: | Torben Wilson | Date: | Wed, 05 Nov 2008 06:16:52 +0000 |
| Subject: | cvs: phpdoc /en/language/types array.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2386@lists.php.net to get a copy of this message | ||
torben Wed Nov 5 06:16:52 2008 UTC
Modified files:
/phpdoc/en/language/types array.xml
Log:
Tiny update to make the examples of array definition functionally
equivalent. Addresses Bug #46251.
http://cvs.php.net/viewvc.cgi/phpdoc/en/language/types/array.xml?r1=1.4&r2=1.5&diff_format=u
Index: phpdoc/en/language/types/array.xml
diff -u phpdoc/en/language/types/array.xml:1.4 phpdoc/en/language/types/array.xml:1.5
--- phpdoc/en/language/types/array.xml:1.4 Thu Feb 21 18:43:17 2008
+++ phpdoc/en/language/types/array.xml Wed Nov 5 06:16:51 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<sect1 xml:id="language.types.array">
<title>Arrays</title>
@@ -597,26 +597,33 @@
<programlisting role="php">
<![CDATA[
<?php
-// this
+// This:
$a = array( 'color' => 'red',
'taste' => 'sweet',
'shape' => 'round',
'name' => 'apple',
- 4 // key will be 0
+ 4 // key will be 0
);
-// is completely equivalent with
+$b = array('a', 'b', 'c');
+
+// . . .is completely equivalent with this:
+$a = array();
$a['color'] = 'red';
$a['taste'] = 'sweet';
$a['shape'] = 'round';
$a['name'] = 'apple';
$a[] = 4; // key will be 0
+$b = array();
$b[] = 'a';
$b[] = 'b';
$b[] = 'c';
-// will result in the array array(0 => 'a' , 1 => 'b' , 2 =>
'c'),
-// or simply array('a', 'b', 'c')
+
+// After the above code is executed, $a will be the array
+// array('color' => 'red', 'taste' => 'sweet',
'shape' => 'round',
+// 'name' => 'apple', 0 => 4), and $b will be the array
+// array(0 => 'a', 1 => 'b', 2 => 'c'), or simply
array('a', 'b', 'c').
?>
]]>
</programlisting>