1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Simple PHP Help Please (Variable inside a String?)

Discussion in 'PHP' started by wd_2k6, Sep 15, 2008.

  1. #1
    Hi there, let's say I have something like:

    $default = 'mysite.com/pic.jpg'

    However the pic.jpg is defined by this: print $comment->extra_abc;

    So basically I need it to look like this:

    $default = 'mysite.com/ print $comment->extra_abc;.jpg'

    But obviously it is just reading it as string, I do not know how to insert this correctly, could anybody advise me in the right direction please?
     
    wd_2k6, Sep 15, 2008 IP
  2. linkinpark2014

    linkinpark2014 Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $default = "mysite.com/ print $comment->extra_abc.jpg"

    double quotes :D
     
    linkinpark2014, Sep 15, 2008 IP
    wd_2k6 likes this.
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thankyou very much! Told you it was simple :)
     
    wd_2k6, Sep 15, 2008 IP
  4. linkinpark2014

    linkinpark2014 Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    correction: $default = "mysite.com/$comment->extra_abc.jpg";

    and ur welcome
     
    linkinpark2014, Sep 15, 2008 IP