What is " .= " for in PHP and when to use?

Asked

Viewed 49 times

0

Good guys I’m with a doubt I was analyzing a code in php and saw that in a foreach is used the expression $main .= '...'; and would like to know what it is for and when to use.

1 answer

2


String concatenation

The same as:

$main = $main . '...';

Ex:

$main = 'teste';
$main .= '1';
$main .= '2';
$main .= '3';

echo $main; //irá imprimir 'teste123'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.