1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 15:52:15 +01:00
Files
archived-doc-en/language/operators/string.xml
2025-04-09 11:36:28 +01:00

44 lines
1.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<sect1 xml:id="language.operators.string">
<title>String Operators</title>
<titleabbrev>String</titleabbrev>
<simpara>
There are two <type>string</type> operators. The first is the
concatenation operator ('.'), which returns the concatenation of its
right and left arguments. The second is the concatenating assignment
operator ('<literal>.=</literal>'), which appends the argument on the right side to
the argument on the left side. Please read <link
linkend="language.operators.assignment">Assignment
Operators</link> for more information.
</simpara>
<para>
<example>
<title>String Concatenating</title>
<programlisting role="php">
<![CDATA[
<?php
$a = "Hello ";
$b = $a . "World!"; // now $b contains "Hello World!"
var_dump($b);
$a = "Hello ";
$a .= "World!"; // now $a contains "Hello World!"
var_dump($a);
?>
]]>
</programlisting>
</example>
</para>
<sect2 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="language.types.string">String type</link></member>
<member><link linkend="ref.strings">String functions</link></member>
</simplelist>
</para>
</sect2>
</sect1>