Closed Thread
Results 1 to 7 of 7

Thread: Combine two strings

  1. #1
    Chan is offline Programming Professional
    Join Date
    Jun 2006
    Posts
    205
    Rep Power
    0

    Combine two strings

    In PHP how can I combine two strings like

    Code:
    $myString "Hey";
    $myString += " you"
    The above doesn't seem to work.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    I dont know but perhaps this will do:-

    Code:
    $first = 'Hey';
    $last = ' you';
    $full  = $first . ' ' . $last;

  4. #3
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    Yes, use a dot instead of the +

    Code:
    $myString "Hey";
    $myString $myString " you"
    Not sure if this works, never tried:

    Code:
    $myString "Hey";
    $myString .= " you"
    but I doubt it.

  5. #4
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20
    what about array_push()

    edit: i wasnt fully coherant when i posted this...but the above is if you want to combined two arrays, not strings
    Last edited by John; 09-24-2006 at 11:50 PM.

  6. #5
    CheeseBurgerMan Guest
    I believe you can do that with the echo command

    Code:
    echo $myString "another string"
    EDIT: Oops, I completely misread that question. Ignore this post.
    Last edited by CheeseBurgerMan; 09-24-2006 at 07:08 AM. Reason: Misread question

  7. #6
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Quote Originally Posted by CheeseBurgerMan View Post
    I believe you can do that with the echo command

    Code:
    echo $myString "another string"
    EDIT: Oops, I completely misread that question. Ignore this post.
    So y not deleting your post? just go to Edit and press delete!

  8. #7
    Chan is offline Programming Professional
    Join Date
    Jun 2006
    Posts
    205
    Rep Power
    0
    The . works - I figured it out after I posted this. Sorry for not updating and thanks

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Combine Different Sites Search Results
    By ybc in forum HTML Programming
    Replies: 2
    Last Post: 08-12-2010, 09:36 AM
  2. SQL vs MySQL (Combine with Java)
    By Dreamcatcher in forum Database & Database Programming
    Replies: 8
    Last Post: 04-29-2010, 10:22 AM
  3. Replies: 3
    Last Post: 09-07-2009, 05:07 PM
  4. Merge Blogs? Combine RSS?
    By Shan Abbasi in forum Website Design
    Replies: 7
    Last Post: 01-10-2008, 08:44 AM
  5. A way to combine programs...
    By Unknown2dark in forum C and C++
    Replies: 4
    Last Post: 04-20-2007, 03:11 PM

Tags for this Thread

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