I am learning php for the first time. In the below code, I have seen echo as in method 2 is more common in various code snippets. But method 1 also prints the same correct answer. My question is why should I use method 2.
<?php
$company[0]= " tweer" ;
$regtype[0]= "Limited";
echo "$company[0] $regtype[0]<br />"; // method 1
echo $company[0]." ".$regtype[0]."<br />"; //method 2
?>
Output:
tweer Limited
tweer Limited
I understand . is used for concatenation but I can get the same result without it as well.