PHP Echo and Print Statement

PHP Echo and Print Statement


If there is an input then it must have an output. So, in PHP also there is two statements which are used for displaying output data to the screen

  • echo
  • print

Both the statement is used for displaying data on the screen.

Difference between Echo and Print:

For Echo Statement: You can pass multiple arguments separated by a comma (,) in echo. It will not generate any syntax error.

Output: web Designin
 
 
For Print Statement: It will generate a syntax error because of multiple arguments in a print statement.
Output: Parse error: syntax error, unexpected token "," in C:\xampp\htdocs\php\index.php on line 5.