6 tips to learn PHP fast and effectively
Php is today the most widely used language/platform for development of web based applications and websites. At the same time it is the easiest to learn and use. There are lots of free tutorial websites out there that can be followed to learn php without much effort. Along with these tools having the right approach can speed up the learning curve.
So here are few ideas that I found to be very helpful in my learning days.
1. Build an application
After learning the basic language constructs start making something on your own. Projects are the real environment to learn all aspects of the language from all angles. Topics like database connection, form handling, sessions, security would all come in themselves and the learning process would be more practical than just reading books chapter by chapter and forgetting again.
For example you could start building a basic cms, that allows to create pages on a website. This would require form handling, database storage, and sessions. Then slowly introduce new things like file upload, media management etc. By the time you are finished writing a complete application you would be knowing much more than what you would have learned by just reading a book.
2. Start using an mvc framework
Once you are able to make a workable application by bunching together scripts, mvc frameworks are the next important thing to learn. Stands for model view controller, and it is a "style" of coding that is now default-ly used in web applications. I would suggest starting with codeigniter as it is the simplest and quickest to learn and adapt to. Almost any kind of php script can be put inside it with little effort.
MVC frameworks primarily enable 2 things, namely :
Separate dynamic(php) code from static(html, css, js) code - This is a necessity as well as a good approach to write and maintain code.
Enforce object oriented coding - mvc brings OOP to web scripting along with all its benefits.
If you have written a basic application in step 1 then the next thing you can do is to put it inside an mvc framework and make it more organised.
3. Read the documentation
Php.net is the php documentation website and contains a lot of literature to read at free time. The comments specially contain useful advice and code snippets. If you visit the site for a particular function, then you can read a few more just for information and so on.
4. Start freelancing
If you are learning php then chances are that you are seeking a career in web development either as a freelancer, job or something similar. If your schedule is not already very tight and you do have a lot of spare time then freelancing is something to give a try.
Lots of freelancing marketplace websites are there like freelancer.com, odesk.com, elance.com where buyers come looking for freelancers to get work done at cheap and affordable prices. Try working on few projects on those websites and you would surely get to learn a lot lot more.
5. Watch other applications and learn
Php is used to code almost any kind of web application like blog, ecommerce platform, cms, forum, image gallery etc. Take your time to study other popular applications and see what they do an how. This gives you a better feel of how applications look and what features they have.
For example wordpress, the most popular blogging platform is a simple php application. It allows for creating posts, pages, uploading images etc. It also has support for plugins. These are the features you can look forward to, if you are trying to build a blog. Similarly oscommerce is a php based ecommerce application.
6. Go to irc
Whether it be about programming or fixing my computer hardware, irc is the first place I throw a question at. IRC is the place where experts can be found on any topic. The room for php is #php. If you are stuck somewhere and google does not seem to be doing enough, then get right into the room of the wizards and ask. Irc is not only the best place to get solution on a problem, but also to get feedback and advice free of cost.