Re: Problems with Arrays and print and echo
| From: | John Wells | Date: | Sat, 08 Apr 2006 13:48:26 +0000 |
| Subject: | Re: Problems with Arrays and print and echo | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233547@lists.php.net to get a copy of this message | ||
> > echo "$this->name[5]\n";
> > echo "$this->ID[5]\n";
> > $a1 = $this->name;
> > $a2 = $this->ID;
> > echo "\n$a1[5] $a2[5]\n";
use curly brackets to help PHP understand what you're after:
echo "{$this->name[5]}\n";
When you're in a string like this, PHP has a hard time knowing when
you're wanting to access a variable, and when you're simply trying to
output text. Using curly brackets clears it up.
HTH,
John W