View Full Version : Echo data from an array

09-04-2007, 10:29 PM
I am trying to echo text from an array but I can't seem to get the quotes right. Could some please look at this code and tell me what I am doing wrong?

if (@include(getenv('DOCUMENT_ROOT').'/openads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:6', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];

echo "$phpAds_raw['html']";


09-04-2007, 11:04 PM
echo "$phpAds_raw['html']";

Use either one of these 2 (I use the second personally)

echo "{$phpAds_raw['html']}";
echo $phpAds_raw['html'];

09-05-2007, 11:17 AM
hey, you might want to enclose the echo contents in a bracket. I find the less "" you have the easier it is to find symantic(programmer) errors.

EG. echo($name['value']); - no brackets might make it a bit easier to read later.