If there is an input then it must have an output. So in PHP also there is two statements which are used for displaying output data to the screen
Both the statement are used for displaying data on the screen.
echo | |
---|---|
This statement can pass multiple string separated by ','. | It cannot pass multiple strings. |
It doesnot return any values. | It always return 1. |
It is faster than print. | It is slower than echo. |
<html>
<body>
<?PHP
echo "<h1>studentstutorial.com</h1>";
echo "welcome to PHP world <br>";
?>
</body>
</html>
<html>
<body>
<?PHP
echo "PHP", "is", "one ", "of", "the","easiest","internet","technology.";
?>
</body>
</html>
<html>
<body>
<?PHP
$a = "welcome to";
$b = "studentstutorial.com";
echo "<h1>$a</h1>";
echo " $b<br>";
?>
</body>
</html>
<html>
<body>
<?PHP
print "<h1>studentstutorial.com</h1>";
print "welcome to PHP world <br>";
?>
</body>
</html>
<html>
<body>
<?PHP
$a = "welcome to";
$b = "studentstutorial.com";
print "<h1>$a</h1>";
print " $b<br>";
?>
</body>
</html>