Re: Outputting Array Values
| From: | Miguel Cruz | Date: | Tue, 09 Apr 2002 14:43:58 +0000 |
| Subject: | Re: Outputting Array Values | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92237@lists.php.net to get a copy of this message | ||
On Tue, 9 Apr 2002, Martin Clifford wrote:
> echo "<tr><td>Item " . ($n + 1) . " is
> $List[$n].</td></tr>";
>
> It successfully prints out the following:
>
> Item Number 1 is .
>
> I just don't understand why it doesn't print out each value in the
> array... any help would be VERY appreciated! Also, please CC me on any
> replies, as I'm subscribed to the digest! Thanks!
If you put an array dereference inside a literal string, you have to
surround the whole assembly with curly braces, thusly:
echo "<tr><td>Item " . ($n + 1) . " is
{$List[$n]}.</td></tr>";
miguel