Ways to echo in PHP

PHP echo, one of the common used PHP operators. Echo is used to output a string. You can combine echo with strings and variables, Here are some examples:

$age = 36;
$name = 'Milos';
echo "Simple string output";

echo "$name is $age";

echo ''.$name.' is '.$age.'';

echo '<h1 class="title">'.$name.' is '.$age.'</h1>';

echo $name,$age;//Milos36

There is no right or wrong method, it comes down to preference or what looks best to you.