How to echo in PHP?

How can I echo in PHP? I am new to programming. I want to echo content to the frontend from a backend PHP script. How can I do that?

You can echo in PHP using the following format

echo "Hello world!";

It will simply output the string Hello World! to the frontend. I am assuming that you have already added the PHP tags as:

<?php
echo "Hello World!";
?>

You can also output variables as in the example below.

<?php
$txt1 = "Hello ";
$txt2 = "World!";
$a = 2;
$b = 3;

echo "<h3>" . $txt1 . $txt2 . "</h3>";
echo $a + $b;
?>

It will output the following

Hello World!

5