...

>

"Hello World" Explained

"Hello World" Explained

This lesson explains in detail the Hello World code written in the last lesson. It explains the basic syntax used in almost every PHP code, including opening and closing tags, echo, semicolons, and comments.

Here’s the code from the previous lesson:

PHP
<?php
echo "Hello, World!\n";
?>

Let’s take a look at this in detail.

We’ll start from the very first line and go step by step!

PHP Opening Tag

A PHP script can be written anywhere in the document, and it signifies the start of the PHP code.

echo

PHP uses a built-in function called echo in order to display one or more strings.

Tip: The echo function is faster than the print() ...