The community is working on translating this tutorial into Spanish, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".

Basic PHP:

Hello, world!

Okay, let's get started with our very first PHP example, the standard Hello, world! With PHP, this is very easy. Be sure that you have installed Apache and PHP before using this example, or at least have access to a server with PHP capabilities. Have a look at the following example:

echo "Hello, world!";

The<?php is important - it's your gate to the PHP interpreter. PHP documents can look just like ordinary HTML documents, and the PHP interpreter will ignore everything that's not within a set of the so-called PHP tags, which opens and ends our example. The echo construct simply outputs the string to the page. Try saving this with a .php extension and navigate to the page. If you're not sure how to do this, then have a look at one of the previous chapters about using the webserver. Once you call this page through the browser, the text "Hello, world!" will appear. We have just created our very first PHP page. In the next chapter, I will tell you a bit about the PHP tags that we just saw, since they are important to understand.

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!