This domain name is for sale. To make an offer please send an email to

Learn about PHP

Compare the Best PHP hosting

PHP is the coolest web programming language ever. At least according to some people. However, it is unquestionable that it is one of the most popular web programming languages. PHP is a server-side, scripting language that can be embedded within HTML and it is used to create dynamic web pages or web applications. PHP code is interpreted by the web server which then outputs a web page to the browsers that access it.

PHP's Capabilities

PHP can be used on almost any platform, Windows or Linux variants and many types of web servers including Apache and IIS. PHP can be used for managing email, connecting to other web sites or servers, processing form information, storing information in a database, creating cookies in a web browser, and much more. It can connect to almost any type of database in the world but most commonly is used in conjunction with MySQL.

PHP's Syntax

PHP borrows a lot of syntax from the C programming language. Syntax is the wording and way that the language has to be used for it to work. PHP is very flexible so it is a great language for beginners to start learning how to program. Like any programming language, PHP has variables but they don’t have to be "typed". They can hold any type of value (text, numbers or arrays) and you can change their type at any time. Here are some important things to learn about PHP:

Sample PHP Code
  • Filename. You can name your PHP files anything you want but you will need to give them a .php extension unless you set up your web server to use other file extensions. If your file has the .php extension then the web server will automatically check it for PHP code, otherwise it won't.
  • Delimiters. Because PHP is usually embedded with HTML you need to specify what parts of the page are PHP and what parts are just static HTML. To do this, you use <?php and ?>. For example: <p><?php print "Hello World!"; ?></p> would print "Hello World!" within a paragraph tag so you would browser would see <p>Hello World!</p>.
  • Variables. Variables hold different types of data. They need to start with a dollar symbol ($) and are case-sensitive.
  • Comments. You can use to different methods to "comment out" PHP code. If code is commented out, it will be ignored. You can comment code like this: /* echo $peanuts; */ This method supports multiple lines. You can also use the single-line comment like this: // echo $peanuts;

PHP also supports functions (blocks of code that can do specific things over and over) and objects (groups of functions that represent real-world objects like a book or a user). You can code PHP in any text editor but there are many PHP editors that support syntax highlighting and other features.

If you are interested to learn about PHP from its creators, we highly recommend reading the PHP manual. For a gentler introduction, you can try W3 Schools' "Learn PHP" section, or read Sitepoint's PHP and MySQL tutorials. We also recommend using a book from the library or one of the following:

If you are looking for some web hosting to use PHP on, check out our comparison of the best PHP hosting or use our Hosting Wizard to find web hosting that best meets your needs.

© Host Shopper | Web Host Comparisons | All Rights Reserved