note 4646 deleted from Arrays by jeroen
| From: | jeroen@php.net | Date: | Wed, 23 May 2001 23:25:33 +0000 |
| Subject: | note 4646 deleted from Arrays by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14225@lists.php.net to get a copy of this message | ||
[Ed: this has to do with variable parsing in strings, see the section about strings -
jeroen@php.net]
Not that opposed to one-dimensional arrays echo and printf are not equivalent, in the following way:
For one dimensional arrays the following gives the same:
<PRE>
echo $a[1];
</PRE>
and
<PRE>
printf("$a[1]");
</PRE>
But to use printf for multidimensional arrays you MUST use the %s formating.
You can not use
<PRE>
printf("$a[1][2]");
</PRE>
And it gets even worse if your indices are strings. You must write
<PRE>
printf("%s",$a[1][2]);
</PRE>