O'Reilly logo

PHP Quick Scripting Reference by Mikael Olsson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 4

image

String

A string is a series of characters that can be stored in a variable. In PHP, strings are typically delimited by single quotes.

$a = 'Hello';

String concatenation

PHP has two string operators. The dot symbol is known as the concatenation operator (.) and combines two strings into one. It also has an accompanying assignment operator (.=), which appends the right-hand string to the left-hand string variable.

$b = $a . ' World'; // Hello World$a .= ' World';     // Hello World

Delimiting strings

PHP strings can be delimited in four different ways. There are two single-line notations: double-quote (" ") and single-quote (' '). The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required