1.

What is the difference between print and echo in php?

Answer»

The ECHO and print are basically the same functions, display output data on the SCREEN. HOWEVER, there are some minor differences between the two such as:

EchoPrint
It has no return value.It has a return value of 1, hence can be used in expressions.
It can work with multiple parameters.It can function with only one argument at a time.
It is a bit faster than PrintA bit slower than Print.

Here’s an example of each Echo and Print to clearly demonstrate their proper usage:

Example Echo

echo "PHP is Fun!";

Print

print "PHP coding is Fun!";



Discussion

No Comment Found