Core PHP, PHP Beginners

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...

Written by Bikash · 1 min read >
What Is echo In PHP With Examples

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 the control structure of a programming language. You can get more details about language construct from here

What Is echo In PHP With Examples

How to Write echo Statements in PHP

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

  • echo is a statement that is used for displaying the output.
  • PHP echo does not return any value, which means it is a void type.
  • In echo, it can print variable, string, and comma-separated strings.
  • print is also used for display output but echo is faster.
  • echo can be written 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 echo statements 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 a complete tutorial and reference of the PHP echo statement with some important examples which help anyone to better understand and use echo in the time of PHP programming.

If you facing any issues while using it, please let me know in the comment.

Also Read:

Happy Coding..!

Was this article helpful?
Written by Bikash
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. Profile

Leave a Reply

Your email address will not be published. Required fields are marked *