cvs: /phpdoc/language types.sgml
| From: | Torben Wilson | Date: | Sun, 14 Nov 1999 23:43:01 +0000 |
| Subject: | cvs: /phpdoc/language types.sgml | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12533@lists.php.net to get a copy of this message | ||
cslawi Sun Nov 14 18:43:01 1999 EDT
Modified files:
/phpdoc/language types.sgml
Log:
Added note about referencing multidimensional arrays in strings.
Index: phpdoc/language/types.sgml
diff -u phpdoc/language/types.sgml:1.5 phpdoc/language/types.sgml:1.6
--- phpdoc/language/types.sgml:1.5 Sun Nov 14 06:58:50 1999
+++ phpdoc/language/types.sgml Sun Nov 14 18:43:00 1999
@@ -234,6 +234,32 @@
</programlisting>
</informalexample></para>
+ <note>
+ <para>
+ It is not possible to reference multidimensional arrays directly
+ within strings. For instance, the following will not have the
+ desired result:
+ <informalexample>
+ <programlisting role="php">
+$a[3]['bar'] = 'Bob';
+echo "This won't work: $a[3][bar]";
+ </programlisting>
+ </informalexample>
+
+ In PHP3, the above will output
+ <computeroutput>This won't work: Array[bar]</computeroutput>. The string
+ concatenation operator, however, can be used to overcome this:
+
+ <informalexample>
+ <programlisting role="php">
+$a[3]['bar'] = 'Bob';
+echo "This will work: " . $a[3][bar];
+ </programlisting>
+ </informalexample>
+
+ </para>
+ </note>
+
<para>
You can "fill up" multi-dimensional arrays in many ways,
but the trickiest one to understand is how to use the