tags:

views:

78

answers:

3

If there is any option available with one echo or print which can't be in other?

A: 

echo vs print

Alexander.Plutov
+1  A: 

echo() can print more than 1 argument, print() can only print 1 argument.

Leon
+3  A: 

Even though they are both really language constructs (even print() is a language constructs), print() can behave like a function, whereas echo cannot.

For example the following:

// Because echo does not behave like a function, the following code is invalid.
($some_var) ? echo 'true' : echo 'false';

// However, the following examples will work:
($some_var) ? print 'true' : print 'false'; // print is also a construct, but
                                            // it behaves like a function, so
                                            // it may be used in this context.
echo $some_var ? 'true': 'false'; // changing the statement around

*Taken from PHP.net

Anriëtte Combrink