PHP Lesson 1 – An Introduction
Posted by Jon on June 10th, 2010
PHP is an open source server-side scripting language. It has become very popular in recent years because of its versatility and because it’s very easy to learn. You can be writing PHP scripts 5 minutes after you are introduced to the language. As I said, it is a server-side scripting language. This means that anything you write in PHP code will not be seen by anyone browsing the internet. The code you write sits on the server, and the server interprets it. After it reads your code, it outputs to the world the results of your code.
For instance, say you wanted to have a copyright notification at the bottom of your website. You could write something like this:
Writing this makes a static date show up on the bottom of your page. But what happens when 2012 rolls around? You have to edit the code and change the date. PHP allows you to get around this. By using a simple PHP date function you can make the date change every year to automatically be the current year! The new code would look like this:
This simple function outputs the current year to the page in place of our static data (“2010”). You can begin to see how useful it is to use a language like this in conjunction with the HTML and CSS that you already know.