PHP is a programming language used for creating dynamic webpages. Dynamic, as opposed to static, simply means that pages are created on the fly based on data from a database, user input or some other “call” for information. Originally created in 1995 as a set of CGI binaries, PHP has withstood the test of time and is currently in its 5th incarnation as PHP5.
Personally, I find that it’s the easiest programming language to work with when dealing with websites. This is because PHP gets integrated directly within HTML code and uses similar tags for performing functions. I’m no genus at coding PHP, but for creating basic scripts or even making changes to advanced scripts, I can hold my own! I also find that it’s a much speedier code when compared to others like CGI or Java and it’s also compatible with many different operating systems, webservers and all web browsers.
Above all, the best part about PHP is that it’s free! There is no cost to run PHP on your webserver and it’s already installed on practically every webhosting plan you can buy.
How does it work?
As mentioned earlier, PHP can be integrated directly within HTML code. By using dilemeters, you can tell PHP where to find code to parse on the page. Here’s an example of some PHP code within a webpage:
<html>
<head>
<title<PHP Test</title>
</head>
<body>
<?php
echo "Hello World";
/* echo("Hello World"); works as well, although echo isn't a
function (it's a language construct). In some cases, such
as when multiple parameters are passed to echo, parameters
cannot be enclosed in parentheses */
?>
</body>
</html>
The above code would display the words “Hello World” directly on a blank web page titled, PHP Test. By looking at this example, you can see how easy it is to have a standard HTML page, while integrating PHP within. Since the PHP parser only recognizes code inside the <?php ?> tags, everything else is sent to the browser as it normally would.
Why would I need it?
If you plan to use a CMS package like WordPress, you’ll be dealing with PHP in some form. Besides that, PHP offers a whole new world of functionality for your website and ultimately your users. Here are some common uses for PHP:
- Web forms – Have you ever filled out a form on a site asking you for information like email address, name and phone number? These are all sent dynamically through a POST command to the website owner so they can collect your information.
- Shopping carts – Every time you’ve bought something online, you more than likely were using PHP to place an order, fill out your information and send a payment.
- Security – If you ever needed to access a secured area for a website, you may have seen PHP in action protecting the secured area.
- Message boards – The majority of message board software is written in PHP.
This list can literally go on and on because just about anything you can think of can be written in PHP. That’s what makes it such a great language to use! It’s also very easy to learn. In fact, what little I know about PHP has all be learned by just looking at code and trying to figure out what it’s trying to do.
Where do I get PHP scripts?
Since its licensing is free (and open), scripts can come in all shapes and sizes from large corporations down to the guy in his basement and can cost anywhere from zero dollars to many thousands of dollars. When looking for PHP scripts to use, you first want to establish your goals.
To begin your search, start looking for scripts at HotScripts.com. They not only have a very large PHP database, but they house every other major programming language as well. Once you get to the site, you’ll notice that their PHP collection is the largest (many times over) than every other collection! This tells you just how popular PHP is.
More information
To get much more information as well as all the nitty, gritty details behind PHP, visit the official PHP website at php.net.
<< Back to Email | Forward to Java >> |