PHP Tutorial

A web server programming language.

PHP Echo / Print

PHP echo and print Statements

In PHP there are two basic ways to get output: echo and print.

They are more or less the same. They are both used to output data to the screen.

Differences:

  • echo has no return value while print has a return value of 1 so it can be used in expressions.
  • echo can take multiple parameters (although such usage is rare) while print can take one argument.
  • echo is marginally faster than print.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics