How to learn php
Tips for php beginner
I learned php basics in 2 weeks. More than 2 years passed since that time and I’m still learning php. So my first tip is «Don’t try to learn everything in php. You don’t need it to be sucessful php programmer.» Here is a short plan on how to start learning php:
Day 0. Yes, php counting starts from zero. You should always remember it. Use day 0 to learn HTML basics and maybe CSS basics if you have enough time. You cannot make websites in php unless you know HTML.
Day 1. Learn some basics about how php works. You should understand that php is an interpreted language. It can be run under various enviroments. The essential thing is that the server should have php libraries installed. If you don’t know how server works, you should learn some basics about it as well (client-server model) Read some info about basic concept of HTTP protocol. For better understanding, I recommend you to use Firefox with LiveHTTP Headers addon installed. Open some of your favorite pages and take a look at the headers your browser sends with requests and the headers returned by the server.
Day 2. Open PHP manual. Read through the first chapters about constants, php syntax, variables, etc. If you don’t have any experience in programming, you may need to have somebody explain all these things. Of course, you can read some books about it, but it’s better to have a tutor who will save your time and possibly some money.
Day 3. Now you should start programming even if you don’t know how to do it. The issue is that if you don’t start doing something quickly, you will lose any interest in php. Find some simple scripts and examples written by other people and try modifying it. You will understand php much faster. Learn how to read scripts written by other people. Just try to translate php code into human language. It will help you in the future to understand the code by other people and to make necessary changes.
When you find any function you don’t know about, don’t be lazy — open php manual and find the function, learn what it does and try to use it in a different way.
Day 4. If you were not lazy in the previous day, you know some php functions. Try to write something by yourself. Think about some script. Not very complex, but useful. For example, a guestbook script (no need for complex validations, smilies, etc.), just a simple functional.
Day 5 and next. Every day you should learn anything useful. Work on new scripts you can imagine. Even if you think you cannot do it — try and use php manual to find necessary functions. You will extend your knowledge and experience step-by-step. And don’t work only on php knowledge, you should extend your experience in related areas as well: continue learning XHTML, CSS, JavaScript, etc.
When you feel confident, try to write something not for yourself. Maybe you can even try some freelance work. The issue is that other people may have some requirements that you couldn’t think about.
Take some tests and certifications from time to time to check your current knowledge level. For example, brainbench tests.