Concept

How do you concatenate strings in PHP?

ComputerScienceOne / String Functions

"PHP has a concatenation operator built into the language. To concatenate one or more strings together, you can use a simple period between them as the concatenation operator. Concatenation results in a new string.\n\n1 $firstName = \"Tom\";\n\n2 $lastName = \"Waits\";\n\n3\n\n4 $formattedName = $lastName . \", \" . $firstName;\n\n5 //formattedName now contains \"Waits, Tom\"\n\nConcatenation also works with other variable types.\n\n1 $x = 10;\n\n2 $y = 3.14;\n\n3\n\n4 $s = \"Hello, x is \" . $x . \" and y = \" . $y;\n\n5 //s contains \"Hello, x is 10 and y = 3.14\""

Related Ideas

How do you concatenate strings in PHP? | ComputerScienceOne | Bifalgorithm | Bifalgorithm