How to Learn PHP Programming

Published on April 6th, 2013 by | Category: Programming

I have decided to start teaching PHP and MySQL from A to Z for those who are interested in learning a strong, applicable and useful programming language. Although you do not have to be a programmer to run an online business and there are so many who make a lot of money through the internet while they know nothing about programming, you have to learn HTML, PHP and MySQL if you want to be professional, successful and independent.

In your online business journey, you will have so many occasions that you have to modify a PHP script, or you need a PHP application for your site and if you don’t know how to do it, you have to order it to a freelance programmer which can cost you a lot. Sometimes you have to pay hundreds of dollars for a small change and modification, and still you can not be sure that you are getting a quality and reliable work. Sometimes you have to wait a lot for the programmer to finish the job and they usually do it with a lot of delay and many of them finally deliver a bunch of garbage files that either don’t work or work with so many errors and bugs. If you complain and ask them to fix the bugs or make some modifications they get fussy and behave arrogantly. It is a pain. Because of all of these reasons, you have to learn to do it yourself. On the other hand, if you like to go beyond an ordinary internet marker and be ahead of your competitors, you have to be a PHP and MySQL programmer, and design and manage professional dynamic websites with the maximum possible capacity.

So let’s learn PHP and MySQL. But before that, you have to know what PHP is.

What Is PHP?

How-to-Learn-PHP-ProgrammingWhen I started learning PHP in 2000, it was just a small open source programming language and it was not known as a popular and common way of developing web pages and dynamic websites. There was no enough documentation on PHP and although it looked like such an easy to learn language, it was not easy to find guidance and help.

Now, everything is changed. There are a lot of documentation about PHP, as well as all the other programming languages. There are also so many free sample scripts ready to install and use. PHP has changed from an unknown programming language to the number one tool for developing the web pages and dynamic websites.

PHP was created in 1994 by Rasmus Lerdorf just to track the visitors of the resume he had posted online. He called PHP because it was used for his own personal web page. PHP stands for Personal Home Page. When PHP was developed more and used for more professional and serious purposes, they called it HyperText Preprocessor. It means PHP processes the data and changes them to hypertext which is the simple HTML codes used on the web pages. PHP does this on the server and the HTML will be appeared on the users computer screen. Therefore, PHP is a “server-side” program and system, because users (clients) don’t see the PHP codes and their performance on their computers screens when they browse the web pages. They just see the HTML codes that are the result of the PHP performance at the server side. I hope it is not too complicated to understand so far.

PHP has an official website at www.php.net. According to this website, PHP is a scripting language which can be used for web development and can be embedded to HTML. It means PHP codes can be used within the HTML codes and the final result will be loaded on the internet browser as HTML.

Scripting language means that PHP works only after an event occurrence. It means an event has to occur to make PHP work. For example, submitting a form or visiting a URL (web address e.g. http://www.vahidchaychi.com) is an event that can make PHP work. JavaScript is a scripting language also. It works only when an event (like clicking on a link, moving the mouse pointer, hovering the mouse pointer on a special object on the web page, submitting a form, right clicking and…) occurs in the web page. Scripting languages are also known as interpreted languages because their codes have to be run through an executable like the PHP module.

Scripting languages are at the opposite side of the compiling languages like C and C++. Compiling languages can work independently and without waiting for an event to happen.

PHP Is a Server-Side System

As it was already explained, PHP is a server side system. It means it has to work on the server. Server is the computer that hosts the websites contents and so you have to upload your website pages and files to it. The texts and pictures of a web page that you visit are in fact uploaded and hosted on a server. When you enter a web page URL to your computer web browser’s (like Internet Explorer, FireFox or Google Chrome) address bar, the web browser sends a request to the server that the web page content (like the texts and pictures) are hosted. Then the server allows the web page content to be transferred to the web page (through HTTP or hypertext transfer protocol), and so you will see the web page on your computer browser. PHP is active at the server side. It processes the data and changes the result to HTML and allows the HTML to be transferred to your computer browser. Therefore, something that works on your computer and what you see on your computer screen (client side) is the result of PHP performance at the server side, not the PHP itself.

PHP Is a Cross-Platform System

PHP works on the servers with any operating system (OS) like Unix, Windows, Macintosh and… . This is a great feature that PHP has. Most other programming languages are limited to one special operating system. It not only can work on all operating systems, it can be switched from one OS to another one very easily and with no modification most of the time.

PHP Versions

5.4.8 is the most recent PHP version. Here we will work on and talk about the PHP codes compatible to 5.3.x and later versions.

PHP Limits

As it was already mentioned, PHP is a server side programming language. Although it is a perfect programming language that can be used for a lot of things, it can not be used for the client side features. Instead, you can always use PHP to create the client side codes like JavaScript, exactly the same way you can use PHP to create HTML codes. For example, when you need the user (your website visitor) to see a special alert message window when he clicks on a special link, you have to use JavaScript. However, this JavaScript can be created by the PHP codes if you are developing your web pages using PHP. When it is the time, we will talk about this in details. For now, I just want you to know the difference of the server-side and client-side languages and the way they have to be used.

How to Learn PHP Programming

Now that you know what PHP is and why you need it, you have to spend some time to learn it. As I mentioned at the beginning of this article, I am serious to write articles about learning PHP from A to Z. I will do my best to use a very simple language to teach you PHP step by step. There are zillions of website that you can refer and learn PHP for free. PHP.net is one of them. However, I am 100% sure that if you refer to those websites while you have no or a primary background about programming and PHP, you will get confused and you will give up before you learn anything, because many of these websites look too complicated and confusing to the beginners. You will have to refer to PHP.net in future when you want to start PHP programming professionally, however, you can not use it to start learning PHP from the scratch, because you will get confused and disappointed. You can follow me here and read the articles I will post about learning PHP step by step. This article, is the first article I have written about PHP here. The next articles will be listed here:

  1. Why Use PHP for Web Developing?
  2. How PHP Works
  3. PHP Learning Requirements: What Do You Need to Start Learning PHP?
  4. Basic HTML Syntax
  5. Basic PHP Syntax
  6. PHP Variables
  7. Different Types of PHP Variables

Leave a Reply

Your email address will not be published. Required fields are marked *