What Is echo In PHP With Example

Generally, peoples are call out PHP echo is a function, however, the echo in PHP is not a function but it is a language construct. This PHP echo statement is majorly used for displaying the value of variables and strings on the web page.

In the above paragraph, we use the term language construct, which means control structure of a programming language. You can get more details about language construct from here https://en.wikipedia.org/wiki/Language_construct.

What Is echo In PHP With Examples

How to Write echo Statement in PHP

Some of the major points and the use of echo in PHP programming are,

  • echo is a statement which is used for displaying the output.
  • PHP echo does not return any value, means it is void type.
  • In echo, it can prints variable, string and comma separated strings.
  • print is also used for display output but echo is faster.
  • echo can be write without and with parentheses: echo, and echo().

Also Read: How PHP Code Works

Now we check some most useful examples which help to better understand about echo statement in PHP.

Display Strings of Text by Using echo


I’m learning about PHP Echo!
These are comma separated strings.

Display HTML Code Using PHP echo


This is a simple heading.

You can also use styling with HTML within the PHP echo statement,


This is heading with style color red.

Display Variables Value


Hello World!

Here is complete tutorial and reference of the PHP echo statement with some important examples which help anyone to better undertand and use of echo in the time of PHP programming.

If you facing any issue while using it, please let me know on the comment.

Also Read:

Happy Coding..!

Was this article helpful?
My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH. I am a web Programmer by profession and working on more than 50 projects to date. Currently I am working on the web-based project and all the CMS and frameworks which are based on PHP.
Posts created 188

Leave a Reply

Your email address will not be published.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top