Welcome to Our Free Tutorial!

PHP-Examples of PHP Echo!

Previous Home Next

As you have study previous chapter (lesson), the PHP Command echo means of outputting the text to the web Browsers. You can use this command in many times when you have to need the outputting the text value in browser. Lets have to start solid Examples…

Outputting the Echo command

If you want to output the string you should use PHP echo. You may place either a string variable or you may use quotes given below the examples to create string the echo command.

PHP Code:

$myString = "Welcome to aonestudy!";
echo $myString;
echo "<h3>I love aonestudy free PHP Tutorial!</h3>";


Php echo cammand

In the above example the first echo output “Welcome to aonestudy!” without hitch. In the second echo statement we use echo to the Header3 HTML statement. We simply put the <h3> tag in the beginning of the string and close it to the end of the string.

Attentive when using echo quotes!

It is most important thing when you are using quotes; you must be attentive when using HTML tags or any other string includes quotes. Echo uses quotes beginning and ends of the string.

  1. Don’t use echo quotes inside string.
  2. Use backslash within the string. To escape quote just insert a backslash before the quotation mark like \“.
  3. You may use single quotes (apostrophes) inside your string.


// This will not work this gives error because quotes around html tag.
echo "<h3 class="aoneH3">Welcome to aonestudy PHP!</h3>";  

// This will work proper not give error
echo "<h3 class=\"aoneH3\"< Welcome to aonestudy PHP!>/h3<";  

// This will work proper not give error because we used an apostrophe '
echo "<h3 class='aoneh3'< Welcome to aonestudy PHP!>/h3<";  


echo quotes
Previous Home Next