PHP Hello World

by Vincy. Last modified on June 2nd, 2021.

This is the first post on my PHP blog Phppot. I am starting this blog with a lot of enthusiasm, love, and confidence. Hope I will add some value to the PHP community.

Following the tradition, let me start with the Hello World program in PHP. Following script displays the sentence “Hello, World!” in the browser. It is a simple and straight forward code. There are two basic ways of doing this hello world print and they are using ‘echo’ or ‘print’.

The difference between using ‘echo’ and ‘print’ is,

  • the echo statement just prints the arguments passed to it and does not return any value. But the ‘print’ statement prints the argument as well as returns a value of 1. Since it returns a value, ‘print’ statement can be used in expressions.
  • the echo statement can take multiple parameters and print statement takes only one parameter.

Example Hello World Code using Echo

echo "Hello, World!";

Example Hello World Code using Print

print "Hello, World!";

In this context of printing ‘Hello, World!’, both ‘echo’ and ‘print’ are same.

PHP Hello World Output

Comments to “PHP Hello World”

  • Joe says:

    Welcome to the wonderful world of blogging and wishing you all the best. PHP enjoys major market share in server side of WWW, approximately 80%. PHP is a beautiful language and my blog runs on it. Looking forward to learn from your blog.

  • tushar jogdand says:

    thanks for all your efforts vincy i love you and your code great work done by you ,
    i thoroughly go from very first page and first code till 48 the last one i downloaded lots of source code and will research on them soon

  • indra says:

    today am joined in your blog.. am a beginner for learning PHP.. Kindly support me mam… thank you so much for provide this valuable blog to our PHP community..

Leave a Reply

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

↑ Back to Top