Find the best answer to your question, help others answer theirs

If you are going to use a passage of Lorem Ipsum, you need to be sure there
isn't anything embarrassing hidden in the middle of text.

  • Anybody can ask a question
  • Anybody can answer
  • The best answers are voted up and rise to the top

1 Answer

2
There is slight difference between echo and print. But both are used to print line of code to the browser.
There are two main difference between echo and print:-

  • echo does not return any value while print returns true or false on successful print.
  • echo is faster than print.
  • print can be used in expressions, where echo cannot.


ECHO :

  • Language constuct and behaves like statement. It won't return value.
  • echo takes multiple parameter seperated by commas.
  • Faster than print.


PRINT:

  • Language construct and behaves like function. It return true / false.
  • print is part of precedence table.
  • print take only one parameter.


  • Echo works faster than print().
  • Echo and print are language construct.
  • Print behaves as a function and it returns an integer value.
  • Echo does not returns any values.
  • Echo is not suitable for conditional construct
  • Print is suitable for conditional construct.
  • Print process is slower than echo
Edit
avatar
Majed Badawi
15.5k 3 10 26
answered 8 hours ago

Leave a Comment

[named hyperlinks] (https://example.com)
**bold**
_italic_

Your Answer

Drop files here or click to upload.