Source of: /manual/en/language.operators.string.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/language.operators.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'language.operators.string.php',
1 => 'String Operators',
),
'up' =>
array (
0 => 'language.operators.php',
1 => 'Operators',
),
'prev' =>
array (
0 => 'language.operators.logical.php',
1 => 'Logical Operators',
),
'next' =>
array (
0 => 'language.operators.array.php',
1 => 'Array Operators',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="language.operators.string" class="sect1">
<h2 class="title">String Operators</h2>
<p class="simpara">
There are two <a href="language.types.string.php" class="type string">string</a> operators. The first is the
concatenation operator ('.'), which returns the concatenation of its
right and left arguments. The second is the concatenating assignment
operator ('<i>.=</i>'), which appends the argument on the right side to
the argument on the left side. Please read <a href="language.operators.assignment.php" class="link">Assignment
Operators</a> for more information.
</p>
<p class="para">
</p><div class="informalexample">
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br />$a </span><span style="color: #007700">= </span><span style="color: #DD0000">"Hello "</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$b </span><span style="color: #007700">= </span><span style="color: #0000BB">$a </span><span style="color: #007700">. </span><span style="color: #DD0000">"World!"</span><span style="color: #007700">; </span><span style="color: #FF8000">// now $b contains "Hello World!"<br /><br /></span><span style="color: #0000BB">$a </span><span style="color: #007700">= </span><span style="color: #DD0000">"Hello "</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$a </span><span style="color: #007700">.= </span><span style="color: #DD0000">"World!"</span><span style="color: #007700">; </span><span style="color: #FF8000">// now $a contains "Hello World!"<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
<p class="para">
See also the manual sections on the
<a href="language.types.string.php" class="link">String type</a> and
<a href="ref.strings.php" class="link">String functions</a>.
</p>
</div><?php manual_footer(); ?>