PHP is a programming language that you can use to write Web applications. A Web application can be anything from a simple “contact us” form through to a fully-fledged blogging system, online store, or forum system.
PHP is a server-side language
PHP is open source
The PHP engine — that is, the code that sits on the Web server and runs PHP scripts — is open source, which means anyone can access and work on the engine’s source code. This helps to ensure that PHP will be around for a long time to come.
PHP is free to download and use, which is one reason why it is so popular among Web hosting companies. You’ll find that the vast majority of Web hosting accounts support PHP.
PHP is geared towards the Web
While many programming languages can be used to build Web applications, PHP is one of the few languages specifically designed for the Web. To this end, it includes a lot of useful Web-related features out of the box, such as:
- Easy ways to read and handle Web forms and cookies
- Functions for creating and manipulating graphics
- The ability to talk to popular databases such as MySQL, and
- Functions for working with HTML.
You can mix PHP code with HTML code
One nice feature of PHP is that you can insert chunks of PHP code into an HTML page. You surround the PHP chunks with special symbols. When the Web server retrieves the page, any PHP chunks are run by the PHP engine, while the other parts of the page are sent as they are to the browser.
This feature makes it easy to add interactivity to otherwise plain Web pages — great for contact forms and the like.
Uses of PHP
You can use PHP to write practically any type of Web application or script. Common PHP applications include:
- Blogging software such as WordPress
- E-commerce systems like Magento
- Content management systems including Drupal and Joomla!, and
- Forum software such as phpBB.
In addition, many popular websites, including Yahoo!, Wikipedia, Facebook, and Digg, use PHP code extensively.
Alternatives to PHP
If you don’t fancy using PHP then there are many similar languages available. Some common server-side languages include:
- Perl (read our Perl articles)
- ASP and its successor, ASP.NET (read our ASP articles)
- Ruby, and
Learn more about PHP
To get started with writing PHP scripts, try the Writing your first PHP script tutorial.