PHP Echo And Print

In PHP, echo and print is used to get output data to the screen but there is some difference, between echo and print. PHP echo PHP echo is used to display the output data.It can be used with parentheses or without parentheses. We can pass multiple stringsseparated by(,) comma operator. It does not return any value. Example 1

<?php
$nm="Rasmus Lerdorf";
echo $nm; // display data without parentheses.
echo ($nm); //display data using parentheses
?>
Output RasmusLerdorfRasmusLerdorf Example 2 (pass multiple argument)
<?php
$fnm="Rasmus";
$lnm="Lerdorf";
echo $fnm.$lnm;
?>
Output RasmusLerdorf PHP print PHP print is also used to display the output. We cannot pass multiple arguments in print. It does return value 1. Example1
<?php
$nm="Rasmus Lerdorf";
print $nm; // display data without parentheses.
print ($nm); //display data using parentheses
?>
Output RasmusLerdorf Example2
<?php
$nm="RasmusLerdor";
$ret=print $nm;
echo ($ret);
?>
Output Rasmus Lerdor1 Followingare the difference between Echo andprint.
                        PHP Echo PHP Print
Echo has no return value. Print has a return value 1.
We can use multiple parameters in echo. We can only use one argument.
Echo is faster than print. It is slow.