SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    combining variables with text

    $var = "something";

    now when I call it, I need it combined with a hardcoded string and I'd like to get this: "something-else"

    now calling it by "$var-else" will not read the variable correctly, is there something that needs to go in between or something, like an &...?

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A simple way of doing it would be just to do

    PHP Code:
    echo $var; echo "-else"
    That would output something-else.
    BKerr

  3. #3
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    Belgian in Mexico
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or one of those
    PHP Code:
    echo $var "-else";
    echo 
    "{$var}-else"
    Regards,

    MichaŽl
    MichaŽl Niessen
    http://assemblysys.com
    (Countries/states/cities with latitude & longitude,
    weathercodes & topical databases)


Bookmarks

Posting Permissions

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