Categories
Code Area PHP

Substitution for Concatenation in PHP

Curly braces is a good substitution for concatenation operation in PHP. It’s is really easy to type “{}” and made our code cleaner. It’s really easy to use and most effective.

Concatenation Operation in PHP:

$var = "Love";
echo "I " .$var . "to play cricket";

we can do the same thing by using curly braces without any concatenation.

Substitution for Concatenation (Curly brace):

$var = "Love";
echo "I {$var} to play cricket";

So we can use  curly braces as a substitution  of concatenation of PHP

.