Forum Statistics

  • Forum Members: 4,502
  • Total Threads: 3,657
  • Total Posts: 1
There are 1 users currently browsing forums.

Partner Sites

Reply
Old 04-27-2010, 11:32 AM   #1 (permalink)
johncarreras
 
Status: Guest
Posts: n/a



Default PHP string concatenation

String concatenation is the string manipulation method when you join 2 or more strings together.
In PHP it is a quite easy task. You can use the concatenation operator which is the ‘.’ (dot). You can join 2 or more strings into one as follows:

$str1 = 'This';
$str2 = 'is a';
$str3 = 'string';

$full = $str1.' '.$str2.' '.$str3;

echo $full; // This is a string

Besides this you can use the operator to append a string to an existing one like this:

$str = 'Main string';
$str .= ' plus another string';

echo $str; // Main string plus another string

If you concatenate a string with a number, the number will (automatically) be converted into a string value, so the output will be “string”:

$num = 100;
$str = $num.' is a number';

echo $str; // 100 is a number
  Edit/Delete Message Reply With Quote


Reply

Bookmarks

Tags
trade show booths, trade show displays, trade show exhibits


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.5.0 RC2