You have probably heard that PHP is much easier to learn than any other programming languages, such as Java or the .NET languages, not to mention Perl, but if you are new to PHP, it can be daunting. If you are new to PHP, we are here to help.
The first block of PHP tutorials are more general and covers the basics of PHP as a language, such as variables, conditionals, HTML forms, loops, arrays, strings, functions… While the second block of tutorials are all about performing a particular task, such as creating captchas, building forms, and even building a complete CMS.
Now remember, take your time with each tutorial and enjoy!
- A Simple PHP Tutorial on PHP.net
- PHP for Beginners Complete Course
- Introduction to PHP Complete Course
- PHP 101: PHP For the Absolute Beginner Complete Course
- MySQL PHP Tutorial
- PHP OOP Tutorial from Beginner to Advance
- List Files & Directories with PHP
- Automatic CSS3 Prefixer & Compressor Tutorial
- Create Your Own Captcha in PHP
- Getting Started with PHP Regular Expressions
- Simple Banner Rotator With PHP, jQuery & MySQL
- Build a CMS in an Afternoon with PHP & MySQL
- PHP Script Image of the Day
A Simple PHP Tutorial on PHP.net
It doesn’t matter what kind of information you are looking for, it is always best to start at the source. This, of course, applies to learning PHP as well, the very site of the PHP programming language: php.net.
I am not saying this tutorial is the easiest, but it is a great tutorial for getting started with. It is more like a general introduction to PHP than a complete guide. It is split into the following sections:
- What do I need?
- Your first PHP-enabled page
- Something Useful
- Dealing with Forms
- Using old code with new versions of PHP
- What’s next?
The tutorial should only take you about 15 minutes to complete – providing you don’t check all the hyperlinks to the other pages. If you do, it will probably take weeks to complete.
PHP for Beginners Complete Course
This tutorial is a much longer and more in-depth that the tutorial above. It covers all the basics of PHP, such as variables, conditionals, HTML forms, loops, arrays, strings, functions, security, file manipulation, MySQL, user authentication. At the end of the tutorial you will find chapters on how to code sample apps, such as polls and online forums.
This is a long tutorial and you may have to go through some chapters more than once, especially if you are new to PHP. So, you will need at least a day or two to go through it all.
Introduction to PHP Complete Course
If you are a fan of video tutorials, then you will love this PHP Course. There are over 200 videos available and they cover absolutely everything about PHP.
The series covers all aspects of PHP, such as how to install XAMMP, how to create your first PHP file, input/output, variables, conditionals, operators, loops, commonly-used functions, strings, arrays, sample applications, etc.
It’s a huge resource and if you want to learn absolutely everything, you will need weeks to cover it all. Each video is reasonably short, though – from 1 to 10 minutes, so you can watch a couple of them in a day, revise them on the next day, and thenmove onto the next video.
PHP 101: PHP For the Absolute Beginner Complete Course
This is another complete PHP course that walks you through the basics. As with the other courses, it covers everything – variables, operators, loops, functions, arguments, MySQL, object oriented programming, sessions and cookies, error handling and security.
It even includes two tutorials for building sample applications – such as a simple web application and an RSS news aggregator. Similarly to the other complete courses, this one will take at least a couple of days to read, learn, and revise.
The tutorials so far include sections on MySQL and how to use it with PHP, but since PHP and MySQL are used together [almost] all the time, it wouldn’t hurt to cover a tutorial that focuses solely on MySQL.
This tutorial explains how to create a new MySQL database, connect to it, create users and give them permissions, write a simple script, create and populate a database, retrieve data, escape characters, print column headers, count fields and rows, write and read images, and use transactions.
If you are already familiar with the SQL syntax this tutorial should only take you 2-4 hours.
This multipart tutorial series focuses on PHP from the object-oriented programming (OOP) point of view. It starts nice and gently, so even if you are a beginner to both PHP and OOP, you will be able to follow along easily.
The first part covers the basic concepts of OOP, such as objects, abstraction, inheritance, encapsulation, and polymorphism, but the following parts delve much deeper.
This tutorial will take you no more than 15 minutes (including the time you need to test the examples). However, the following tutorials in the series are much longer and more complicated, so for each of them you might want to devote half an hour or more.
Lists of files and directories are very common in web development. This tutorial will show you how to list files and directories with the
glob() function, a combination of the
closedir() functions, and the
You will also learn some advanced file/directory listing techniques – SPL iterators, such as the
RecursiveDirectoryIterator, and the
The tutorial isn’t as complex as it might at first seem, but you probably should budget at least 45 minutes to complete it. It could even take longer, if everything is not working as expected and you need to make some fixes.
CSS files are text files but they can be very large. That is why they will benefit from some compression. Additionally, instead of writing all CSS3 properties with browser-specific prefixes by hand, this can be automated with PHP.
This tutorial will teach you exactly how to do this: Generate CSS3 properties with browser-specific prefixes, how to concatenate all the CSS files to save space and reduce load time, and how to do both automatically when a web page is requested.
The estimated time to complete the tutorial is about an hour.
This short tutorial has been written in a typical programmer’s fashion, meaning it has little to no explanation, short to missing comments, and the assumption that everything is obvious and clear.
However, aside from this, it is a useful tutorial and the slightly more advanced programmers might love it just because it uses few words and plenty of code.
And now a tutorial on everybody’s favorite: regular expressions. Unfortunately for everybody who hates them, regular expressions are pretty useful, though often you can bypass them with other techniques.
The tutorial in the link explains what regular expressions are, the Perl compatible regular expressions, the basic syntax of PHP regular expressions, how to use regular expressions in PHP, useful regex functions. Additionally, the tutorial includes a cheat sheet where all the basic stuff is gathered in one neat place.
The tutorial could take you an hour or two to complete but this depends on your familiarity with regular expressions. If you are a total stranger to them, expect to read some sections multiple times and, naturally, this will take you much more time.
This tutorial goes beyond PHP, but since in real life that is exactly what you need, that is why the tutorial is included here. First you need to create the database schema, then the XHTML code, then the CSS, and only after that you will move on to the PHP side of things.
The tutorial will take you at least 2 hours to complete, and that is if you don’t have to make a lot of modifications to the code.
If we are honest here, this tutorial will probably take you more than an afternoon to complete. Having said that, it also isn’t as hard as it seems.
In order to create the CMS, you do need to be familiar with the SQL syntax and MySQL, so if you do lack knowledge in these areas, first check the tutorials that teach MySQL above and then come back to this one.
The CMS you will be learning to build will have all of the basic features you would expect from a CMS.
The frontend will have:
- Homepage with the 5 most recent articles
- Article Listing Page (archives), where snippets of all articles are displayed
- A “View Article” page (single post), where visitors can read the entire article
And, the backend will have:
- Admin login/logout
- List of all articles
- Add a new article
- Edit an existing article
- Delete an existing article
PHP Script Image of the Day
This tutorial shows you how to create a PHP script image of the day. All you need to do is find today’s date (with the help of the
date function), store the value in the “
$today” variable, and compare
$today with the name of the day.
Then you display the message “Today is ” … ” (you can modify the message, of course), together with the image of the day.
The estimated time for the completion of the task is about 10 to 15 minutes. This however doesn’t include the time to search for the images to display every day, so you may want to prepare them in advance.
PHP is fun, and it can be used for so many tasks. These tutorials won’t make you a PHP guru, but they will help improve your skills and hopefully allow you to develop more complex PHP applications.