“Hello, World!” in PHP
Every programming language has it’s basic Hello, World! script. PHP has no exception. It is a simple script that only displays the words “Hello, World!” Let’s see “Hello, World!” in PHP.
So how to write this most basic of computer programs in PHP? The two simplest ways are using print and echo, two similar statements that are more or less the same. Both are used to output data to the screen. Echo is slightly faster than print. Print has a return value of 1 so it can be used in expressions, while echo has no return value. Both statements can contain HTML markup. Echo can take multiple parameters; print takes one argument. For the purposes of this example, they are equal.
Print “Hello, World!”;
Echo “Hello, World!”;
In each of these two examples, the <?php indicates the start of a PHP tag and the ?> indicates an exit from PHP. These entrance and exit tags identify the code like PHP, and they are used for all PHP coding.