Live data from Hacker News

Ask HN: What's the best way to start learning PHP?

news.ycombinator.com

1–10 of 21 posts

Ask HN: What's the best way to start learning PHP?

#1
I'm looking for the best resource(s) to learn PHP, and I have absolutely no idea where to start. Ideally, this resource will:

- Be for a complete beginner - Embrace Simplicity - Be down to earth - Be a good way to develop a foundation to move on to more intermediate / advanced things

I know a lot of you are PHP gurus! Thank you for the help, there's just so much out there and I'd love an opinion on where the best place to start is. Thanks!

Re: Ask HN: What's the best way to start learning PHP?

#3
There is no single recipe that fits everyone's needs. But it's safe to go step by step, from basic tutorials to coding practice to understanding more complex code. Invest in a good reference book later when you know you will stick to the language.

As an absolute beginner you could first have a look at these pages: http://www.php.net/manual/en/getting-started.php and http://devzone.zend.com/article/627 Then you could play around with some code before learning a simple but powerful framework like Kohana or Codeigniter.

Re: Ask HN: What's the best way to start learning PHP?

#5
Don't. Edsger Dijkstra once wrote:

The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.

I'm not sure I'd go quite that far in describing PHP since it actually does have most of the facilities of a modern programming language. I will say that it isn't a good choice for learning the basics of programming, for reasons that are more cultural than technical.

A large amount of the example code that can be found around the net in PHP is less than exemplary relative to what's typical for other languages. To make matters worse, the language itself has a large number of inconsistencies and bad practices in its design. It feels like something that has built up over the years a hack at a time with no coherent design philosophy behind it because, if I understand the history right, that's about how it happened. While many real-world systems are like that, it should be your goal as a programmer to avoid it.

What do you want to get out of learning PHP? Maybe we can suggest some alternatives.

Re: Ask HN: What's the best way to start learning PHP?

#7
post #4

Get a book and just get stuck in. Do all the exercises, do not copy and paste. Search Quora/Stackoverflow/Amazon for recommendations.

Sounds good as a resolution, but sticking to a book may not work for all.

Yeah, I found Youtube videos very helpful as well. If you know where to look, you can find Lynda.com videos around too..

Re: Ask HN: What's the best way to start learning PHP?

#9
You need to suggest to us at what level you're at. Are you familiar with HTML/CSS? Are you competent with any other languages at all?

Guessing that your familiar with HTML, I'll mention that you'll probably find it easier if you set a target end-product for your efforts. Like, planning to make a simple blog system or a rss parser. Don't overplan it. Just sketch it out, so to speak, try to find a guide for it (there are plenty of guides for creating a simple blog or rss reader in php) and then try to tackle each part of it in turn.

You might also want to try using a PHP framework like Codeigniter (which is nicely documented), CakePHP or Kohana.

Re: Ask HN: What's the best way to start learning PHP?

#10
I had no programming experience outside of VBA Excel macros and just jumped in with a project. I googled everything I needed. Within a month, almost everything I needed was exclusively in the online PHP documentation manual.

Start with a project. Build a login system, from user sign up to sign on. That will teach you sessions, user input validation and interacting with your database.

Post reply on HN