Re: cvs: /phpdoc/language types.sgml

From: Date: Sun, 14 Nov 1999 23:44:12 +0000
Subject: Re: cvs: /phpdoc/language types.sgml
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-12534@lists.php.net to get a copy of this message
That's exactly why PHP 4 supports the following syntax: echo "This will work: ${a[3][bar]}"; At 11:43 PM 11/14/99 +0000, Torben Wilson wrote: >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 > > > >-- >PHP Development Mailing List <http://www.php.net/> >To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net >For additional commands, e-mail: php-dev-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net -Andrei

« previous php.dev (#12534) next »