What are the differences between echo and print?

Both echo and print method print the output in the browser but there is a difference between these two methods.

echo does not return any value after printing the output and it works faster than the print method. print method is slower than the echo because it returns boolean value after printing the output.

Sample Code

echo "PHP Developer";
$n = print "Java Developer";

Posted Under

Leave a Reply

Your email address will not be published. Required fields are marked *