php beginner guide: introduction to php

Date: June 8 2009 | 1 comments | Category: Uncategorized

Well.. Here we are with this first chapter of a simple guide to php for beginner. Before start I think is good if you know something about the history of this script languages.
Php was “born” in 1994 from Rasmus Lerdor, was composed of a set of macro whose task was to simplify the websites management.

The first step was the expansion of the macro with a packet called form interpreter. From here Php was in continue expansion and now is a one of the most used langues in the websites with a bigger community and over 10.000.000 of server that support php now. The reason of this big expansion are lots. Php is compatible with any reliable php web hosting , is open source, is free, is simple and works perfectly with Apache, the most used web server in the world.

The important thing that you must remember about php, is that this language is server side.

What it means that php is a server side languages?

It means that the language is interpreted from the server, namely the server, through an interpreter, received the php code from the page and returns the html code. indeed if you look at the source code of a php page you will never see php code, but only the html that the server interpreter returns.

This is the difference between php and javascript, for example, that is a client side language, so it depend on the browser user and not from the server.

Php is perfect to work with database like mysql, to create e-commerce sites, administration systems and other more, one of a great example is WordPress, the CMS blogging platform that runs this website.

How to recognize php code? Here an example:

<?php echo “Hello World!”; ?>

This is an example, if you will try this code the page will results this :

Hello World!.

A php tag start always with the “<?php” and end with “?>” you can omit the “php” in the start tag.

Other important thing of the php syntax is the “;” at the end, this means the end of the instruction(never forget, is important!) , this was inherited from the most used languages, like c, java and similar.

Finally the most simple instruction in php, the “echo” that say to the server this : write what is wrote between the ” “.

How I said if you will look at the source code you don’t see the php code, but only the html that the server returns.
Well for the moment I think is good, now you know what is php, how it works and how to start writing code, I think is a good begin.

This is only the first chapter of this php guide for beginner, so … stay tuned for the other chapters.

Hasta Luego!

1 appreciated comments. + Add your

  1. dodenkrant says:

    I added your blog to Google Reader.

Leave a Reply