In PHP, there are two basic ways to get output: echo and print.
They are nearly identical, and they are both used to output data to the screen.
echo and printecho has no return value, while print has a return value of 1 (so it can be used in expressions).echo can take multiple parameters (although such usage is rare), while print can take exactly one argument.echo is marginally faster than print.echo StatementThe echo statement can be used with or without parentheses: echo or echo().
<?php $txt1 = "Learn PHP"; $txt2 = "IntricateDevo";echo "<h2>" . $txt1 . "</h2>"; echo "Study programming at " . $txt2 . "<br>"; ?>
(Note: The dot . operator is used to join or concatenate strings together in PHP).
print StatementJust like echo, the print statement can be used with or without parentheses: print or print().
You will mostly see echo used in modern PHP applications because it is slightly faster and requires fewer keystrokes.