What is the difference between echo and print statement?

Showing Answers 1 - 15 of 15 Answers

Suparna Dey

  • May 29th, 2006
 

Difference1:

echo() can take multiple expressions,Print cannot take multiple expressions.

echo has the slight performance advantage because it doesn't have a return value.

True, echo is a little bit faster.

rabbi

  • Jun 29th, 2006
 

echo("something") is always a function. print("something ") is a function butprint " " is not a function but simple a statement.

  Was this answer useful?  Yes

Trii

  • May 2nd, 2007
 

Actually . . .

echo and print are both language constructs and do not (and should not) require parenthesis. The difference is that print returns a value indicating success where echo does not

Shunmuga prasath

  • Aug 3rd, 2007
 

Print is a function whereas echo is a language construct.
You can use something link $a = print $b while you cant use $a = echo $b.

Vignesh

  • Nov 17th, 2007
 

Print is a Function. Echo is an keyword.

Print return true or false value on printing. Echo doesn't

Print cannot have multiple expression whereas Echo can have Multiple Expression statement to echo the value.

bluemonk

  • Aug 31st, 2008
 

Both echo and print are language constructs. 

However print() acts like a function in that it returns a value and can be used in complex expressions.

Furthermore, echo without parentheses can take multiple arguments.  Echo with parentheses and print can only take a single argument.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions