Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-04-2007, 10:29 PM   PM User | #1
Jacobb123
Regular Coder

 
Join Date: Aug 2006
Posts: 311
Thanks: 0
Thanked 1 Time in 1 Post
Jacobb123 has a little shameless behaviour in the past
Echo data from an array

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?

Code:
<?php
    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']";

?>
Jacobb123 is offline   Reply With Quote
Old 09-04-2007, 11:04 PM   PM User | #2
Mwnciau
Regular Coder

 
Join Date: May 2006
Location: Wales
Posts: 820
Thanks: 1
Thanked 82 Times in 79 Posts
Mwnciau is on a distinguished road
Quote:
echo "$phpAds_raw['html']";
Use either one of these 2 (I use the second personally)

PHP Code:
echo "{$phpAds_raw['html']}";
echo 
$phpAds_raw['html']; 
Mwnciau is offline   Reply With Quote
Old 09-05-2007, 11:17 AM   PM User | #3
idalatob
Regular Coder

 
Join Date: Sep 2007
Location: Grahamstown, South Africa
Posts: 237
Thanks: 6
Thanked 17 Times in 17 Posts
idalatob is on a distinguished road
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.
idalatob is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:48 PM.


Advertisement
Log in to turn off these ads.