Both echo
and print
are used to output data, but they have key differences:
echo
has no return value, while print
always returns 1echo
can take multiple parameters, print
can only take oneecho
is marginally faster since it doesn't return a valueecho
can be used with or without parentheses, print
can also be used both waysecho "Hello", " World"; // Works
print "Hello World"; // Works
// print "Hello", " World"; // Error - multiple parameters not allowed