Echo vs. Print in PHP

Echo() and Print() are not functions but language constructs in PHP. They are both used to output strings and there are very minor differences between echo and print in PHP.

Echo (PHP)Print (PHP)
Parametersecho can take more than one parameter when used without parentheses. The syntax is echo expression [ expression[ expression] … ]. Note that echo ($arg1 $arg2) is invalid.Print only takes one parameter.
Return valueEcho does not return any valuePrint always returns 1 (integer)
Syntaxvoid echo ( string $arg1 [ string $… ] )Int print ( string $arg )
What is it?In PHP echo is not a function but a language construct.In PHP print is not a really function but a language construct. However it behaves like a function in that it returns a value.

Recommended Tutorials for you

Related posts

Difference Between Mysqli_fetch_array And Mysqli_fetch_assoc And Mysqli_fetch_row

Anuj Kumar

Diffrence between ajax and jquery

Anuj Kumar

Difference between SQL and MYSQL

Anuj Kumar


Anuj Kumar

Difference Between PHP and Javascript

Anuj Kumar

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.