Re: A quesiton about arrays and indexes
| From: | Rasmus Lerdorf | Date: | Sat, 30 Mar 2002 00:26:57 +0000 |
| Subject: | Re: A quesiton about arrays and indexes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90735@lists.php.net to get a copy of this message | ||
Complex arrays inside quoted strings either need to be escaped with {}'s
or drop out of the quoted string to display them. ie.
echo "<td>".$week[$i][$j].": ".$week[$i][$k][0]."</td>";
or
echo "<td>${week[$i][$j]}: ${week[$i][$k][0]}</td>";
-Rasmus
On Fri, 29 Mar 2002, David Johansen wrote:
> Ok, I have a question about arrays and indexes. Something weird happens when
> I try this:
>
> echo "<td>week[$i][$j]: $week[$i][$k][0]</td>";
>
> Of course $i and $j have their appropriate values. It just prints out
> Array[0][4] (0 and 4 being the values of $i and $k, but if I do the code
> below it works just fine. Is there something I'm just not getting or
> something?
>
> $temp = $week[$i][$k][0];
> echo "<td>week[$i][$j]: $temp</td>";
>
> THanks,
> Dave
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>