Section 6.3. String Operators


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!" 



PHP in a Nutshell
Ubuntu Unleashed
ISBN: 596100671
EAN: 2147483647
Year: 2003
Pages: 249

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net