andi
andi

Reputation: 35

How to concatenate in PHP?

Create a variable called fullName and assign it a value equal to the concatenation of the firstName variable, a space, the middleName variable, a space, and the lastName variable.

I have :

$firstName = "Tony";
$middleName = "Muscles";
$lastName = "Montana";

Why doesn't the following work?

$fullName = $firstName." ".$middleName." ".$lastName

Upvotes: 0

Views: 1081

Answers (1)

kaizenCoder
kaizenCoder

Reputation: 2229

Missing the semicolon:

$fullName = $firstName.' '.$middleName.' '.$lastName;

Upvotes: 3

Related Questions