Re: Problems with Arrays and print and echo

From: Date: Sun, 09 Apr 2006 18:09:33 +0000
Subject: Re: Problems with Arrays and print and echo
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-233628@lists.php.net to get a copy of this message
John Wells wrote:
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 Thanks.


« previous php.general (#233628) next »