Re: Problems with Arrays and print and echo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux