There are two ways to get the output in PHP:

  1. echo
  2. print

The basic difference between echo and print: echo has no return value while print has a return value of 1 so it can be used in expressions.

 

echo Statement

The echo statement may be used with or without parentheses: echo or echo().

Example:

<?php
echo "Hello world!
";
echo "I'm learning a PHP Programming!
";
?>

 

print Statement

The print statement may be used with or without parentheses: print or print().

Example:

<?php
print "Hello world!
";
print "I'm learning PHP Programming!";
?>