From lesson 1 and 2, you now know a little about what PHP is, and you’ve installed (or have access to) a server. Now we are ready to begin making our first PHP page. We keep it simple and easy, but after you have gone through this lesson, you will understand much more about what PHP is and what you can do with it.
Basically, a PHP file is a text file with the extension .php which consists of:
- HTML tags
- PHP Scripts
You already know what text and HTML tags are. So let’s look a little more at PHP scripts. If you don’t know about HTML and its tags then click here to know about HTML and Tags in HTML
PHP Documentation Group has issued detailed documentation for PHP. Throughout the tutorial, there will be many links to the documentation. The goal is that you become accustomed to looking up and finding answers to your questions. PHP is so extensive that you can’t to learn all facets in this tutorial. But PHP is not difficult! On the contrary, PHP is often very similar to plain English.
Let’s get started with your first PHP page.
Example: Hello World!
Open any text editor and copy past the following code into it.
<title>My first PHP page-tutsocean.com</title>
echo "<h1>Hello World!</h1>";
Note: If you see the result and go ahead to see the source code from browser then you will see that “The PHP codes are gone!”. Â It is only the server that can see the PHP codes – the client (the browser) only sees the result!
Let’s look at what happened. We asked the server to write <h1> Hello World!</h1>. In a more technical language, one would say that we used the string function echo to write a specified string to the client where the semicolon ends the command. But do not worry! In this tutorial, we try to keep the technical language at a minimum.
Now you are ready with your First PHP Page.
113 total views, 4 views today