Question Detial
There is slight difference between echo and print. But both are used to print line of code to the browser.
There are two main difference between echo and print:-
- echo does not return any value while print returns true or false on successful print.
- echo is faster than print.
- print can be used in expressions, where echo cannot.
ECHO :
- Language constuct and behaves like statement. It won't return value.
- echo takes multiple parameter seperated by commas.
- Faster than print.
PRINT:
- Language construct and behaves like function. It return true / false.
- print is part of precedence table.
- print take only one parameter.
- Echo works faster than print().
- Echo and print are language construct.
- Print behaves as a function and it returns an integer value.
- Echo does not returns any values.
- Echo is not suitable for conditional construct
- Print is suitable for conditional construct.
- Print process is slower than echo
Hot Questions
How to Get the Size of all Tables in a database in MySQL?