PHP Hello World

To trigger the PHP commands, you need to learn a new tag. The first part is:


The first thing you may notice is that the tag has not been closed. This is because entire sections of PHP can be placed inside this tag and they finish only when the closing part is encountered, which looks like this:


The way you use this tag is quite flexible. Some programmers open the tag at the start of a document and close it right at the end, outputting any HTML directly from PHP commands.

Others, however, choose to insert only the smallest possible fragments of PHP within these tags wherever dynamic scripting is required, leaving the rest of the document in standard HTML.

The latter type of programmer generally argues that their style of coding results in faster code, while the former say that the speed increase is so minimal that it doesn’t justify the additional complexity of dropping in and out of PHP many times in a single document.

As you learn more, you will surely discover your preferred style of PHP development.

echo "Hello world";

In the above example first line will start php code statements, everything after this line will be treated as server side parsing and will be executed by php. The second line is echo which is used to print further parameters on web page, next withing quotes is a string which will be displayed on web page as it is. the last line is for closing php tag which end php script statements.


You may also like...

No © Loop and Break