Results 1 to 6 of 6

Thread: PHP again - String concatenation

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    PHP again - String concatenation

    How can I concatenate two variables as strings? For example,

    PHP Code:
    $a "asdf";
    $b "ghjk";
    fwrite($theFile, ???); //want to have asdfghjk 
    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    scoutt
    Guest
    you can try" join($a,$b) "

  3. #3
    scoutt
    Guest
    actually that would be
    PHP Code:
    $a "asdf";
    $b "ghjk";
    $c join("",$a$b)
    fwrite($theFile$c); //want to have asdfghjk 
    I think that would work since I didn't see any other function that would do it besides implode(), which is the same.

  4. #4
    denniswrenn
    Guest
    That can be simplified:


    Code:
    $a = "Hello ";
    $b = "World";
    $c = $a . $c;
    //or
    $a = "Hello";
    $b = "World";
    $c = "$a $b";

  5. #5
    scoutt
    Guest
    I was thinking that but wasn't sure if that would work,

  6. #6

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Cool, thanks guys
    Alcohol & calculus don't mix.
    Never drink & derive.

Posting Permissions

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



Click Here to Expand Forum to Full Width