PHP Hello World

Not be cliché, but I any book, tutorial or website discusses a programming language always begins with a program that simply displays the text “Hello World” on the screen and I intend to follow that tradition.

The process of writing text in PHP requires you to use either the “echo” of “print” function. There are some very minute differences between these two functions, but for these purposes, we will just say that they are interchangeable. If you really want to know the differences, there is an article that details this here.

Anyways, here is the hello world program for PHP.

<?
echo "Hello World";
?>

You could also use the print function and that would look like this:

<?
print "Hello World";
?>

You will notice that at the end of each line of code there is a semi-colon. Like many other languages, this is used at the end of most of the lines of code.

Leave a Reply

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