Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Posts
    311
    Thanks
    0
    Thanked 1 Time in 1 Post

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

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    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']; 

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •