Приглашаем посетить
Достоевский (dostoevskiy-lit.ru)

Section 6.3.  String Operators

Previous
Table of Contents
Next

6.3. String Operators

There are only two string operators in PHP: concatenation and shorthand concatenation . Both are shown in Table 6-3.

Table 6-3. The string operators

.

Concatenation

Returns the second value appended to the first: $a . $b

.=

Shorthand concatenation

Appends the second value to the first: $a .= $b


These operators are used to join strings together, like this:

    $first = "Hello, ";
    $second = "world!";

    // join $first and $second; assign to $third
    $third = $first . $second;
    // $third is now "Hello, world!"

    $first .= " officer!";
    // $first is now "Hello, officer!"


Previous
Table of Contents
Next