If there is any option available with one echo
or print
which can't be in other?
views:
78answers:
3
+1
A:
echo() can print more than 1 argument, print() can only print 1 argument.
Leon
2010-09-01 07:04:46
+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
2010-09-01 07:10:47