echo: echo is not a function rather it is described as a language construct. It accepts an list of argument (multiple arguments can be passed) and returns no value or returns void. It cannot be used as a variable function in PHP. It is used to display the output of parameters that is passed to it. It display the outputs one or more strings separated by commas.
GeeksforGeeks Computer science portal
print: It is not a real function. it is a language construct but always returns the value 1. So it can be used as an expression. Unlike echo, print accepts only one argument at a time. It cannot be used as a variable function in PHP. The print outputs only the strings. It is slow compared to that of echo.
print_r(): print_r() is a regular function. It outputs the detailed information about the parameter in a format with its type (of an array or an object), which can be easily understandable by humans. In this function the output get stored on the internal buffer when the return parameter is passed. If pass the return parameter to TRUE, print_r() would return the complete information rather than just print it. During walk-through this function helps in identifying any of the glitches while executing the program. It is more similar to the var_dump() function.
Array (  => GeeksforGeeks  => Computer  => Science  => Portal )
GeeksforGeeks 10.14 Array (  => Geeks  => for  => Geeks )
- PHP | echo and print
- How to echo HTML in PHP ?
- echo command in Linux with Examples
- Difference and Similarities between PHP and C
- Difference between try-catch and if-else statements in PHP
- Difference between isset() and array_key_exists() Function in PHP
- Difference between bindParam and bindValue in PHP
- What is the difference between the | and || or operator in php?
- What is the difference between public, private, and protected in PHP?
- Difference between require-dev and require in PHP?
- What is the difference between HTTP_HOST and SERVER_NAME in PHP?
- What is the difference between is_a() function and instanceof in PHP?
- What is the difference between array_merge and array + array in PHP?
- What is the difference between a language construct and a “built-in” function in PHP ?
- Difference between “!==” and “==!” in PHP
- Difference between array() and  in PHP
- What is the difference between single-quoted and double-quoted strings in PHP?
- Difference between break and continue in PHP
- What is the difference between Perl and PHP ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.