PHP echo VS print statement
If you want to show any results from the server in PHP, you need to use either echo or print. These two are languages Construct in PHP . Language Construct are faster than the function. Because language Construct can show results without compiling, on the other hand, the functions can show results after compiling. And because of those languages Constructs can write parenthesis “i.e ()” with or without parenthesis.
<?php echo "Hello world"; echo ("Hello World"); print "Hello World"; print ("Hello World"); ?>
Following all ways are correct:
Language Constructs are called basic components of any language.
We will show you deference between Echo And Print with example :
1. You can take multi parameters in echo if you are not used parenthesis. On the other hand, you can use only single parameter in print , whether it is with parenthesis or without parenthesis. Notice the following examples:
<?php echo "1"; //valid echo "1","2"; //valid echo ("1","2"); //Invalid print "1"; //valid print ("2"); //Valid print "1","2"; //Invalid print ("1","2"); //Invalid ?>
The above line 2, 3, 5, 6 is correct. The rest will show wrong.
2. echo has no return value. On the other hand print boolean true means, it will return 1. Seeing the example below will clear the rest:
<?php echo print (5); // Output 51 ?>
Here we get 5 as the result of print. Then return result of print 1 we get through echo. For which we get 51 together here as a result.

Hi, My name is Masud Alam, love to work with Open Source Technologies, living in Dhaka, Bangladesh. I’m a Certified Engineer on ZEND PHP 5.3, I served my first Fifteen years a number of leadership positions at AmarBebsha Ltd as a CTO, Winux Soft Ltd, SSL Wireless Ltd, Canadian International Development Agency (CIDA), World Vision, Care Bangladesh, Helen Keller, US AID and MAX Group where I worked on ERP software and web development., but now I’m a founder and CEO of TechBeeo Software Company Ltd. I’m also a Course Instructor of ZCPE PHP 7 Certification and professional web development course at w3programmers Training Institute – a leading Training Institute in the country.
Nice! I was looking for these differences with examples.
Thanks