» Birthday Bundle - Over $400 worth of Envato files for just $20

PHP: Using the string concatenation

Posted on September 6, 2008, Filled under PHP,  Bookmark it

Here are some simple examples of string concatenation:

<?php
$first_name = 'John';
$last_name = 'Jones';
$work_area = 'IT Industry';

$text = 'His name is '.$first_name.' '.$last_name.' and he is working in the '.$work_area;

// Output: His name is John Jones and he is working in the IT Industry
echo $text;
?>

Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!

Get our RSS Feed!

Related Posts

2 Replies to "PHP: Using the string concatenation"

  1. Im guessing you meant: and he is working in the ‘.$work_in instead of $work_area;

    ;)

    1. Sure, thanks for noticing ;)

Leave a Reply


* = required fields

  (will not be published)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: If you want to post CODE Snippets, please make them postable first!
(e.g. <br /> should be converted to &lt;br /&gt;)