There are two basic ways to get the output in PHP: echo and print , both are used to display the output on screen.
echo can be used with or without parentheses: echo or echo(). some examples of echo
//echo with html text data
echo "<h1>PHP is scripting language </h1>";
//echo without parentheses
echo "Hello World!";
//echo with parentheses
echo ("Hello World!");
//echo with multiple parameters
echo "PHP ", "is a ", "server-side ","scripting language";
$string1=" Coding";
$string2=" at Qoify.com";
echo "Learn ".$string1.$string2;
$a=5;
$b=7;
echo $a+$b;
 
Print can be used with or without parentheses: print or print(). some examples of print
//print with html text data
print "<h1>PHP is scripting language </h1>";
//print without parentheses
print "Hello World!";
//print with parentheses
print ("Hello World!");
$string1=" Coding";
$string2=" at Qoify.com";
print "Learn ".$string1.$string2;
$a=5;
$b=7;
$retun = print $a+$b;
// print return type check
print "Return type:".$retun;
