Welcome to Our Free Tutorial!

Difference between echo and print

Previous Home Next

The echo and print works same but the difference is parameter and speed.
Parameter: echo always use more than one parameter but print does not do this.
Speed: echo is more faster than print.

Example:

<?php

print "aonestudy","PHP";

?>
It will give an error where as
<?php

echo "aonestudy","PHP",1,2,3;

?>

Output:

Aonestudy,php,1,2,3

Use HTML Tag in PHP Syntax

<html>
<head>
<title>PHP Syntax Example</title>
</head>
<body>
<h2>Welcome to the aonestudy PHP </h2>
<?php
echo "<b>Welcome</b><br> ";
echo "<u>To the world of</u><br>";
echo "<i>aonestudy PHP</i><br>";
?>
</body>
</html>

Output:

html simple prog
Previous Home Next