15 points · by koichi · 15y ago · 19 comments
- 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!
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.
Search Quora/Stackoverflow/Amazon for recommendations.
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.
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.
Next step is to build your project and google your way through it. With your guideline that you wrote it will help you look up things and once you see the code matched with what you wrote things will click more. Don't just copy and paste what you see but learn what the code is doing and if need be look up things you do not get like "die" or why echo instead of print.
Lastly read up on security since what ever you build will probably not be able to go live. Read why that is and how to fix it.
That's not to say it's good or talented knowledge, but it's basic knowledge. (People don't like that Wordpress mixes templating with code. It's unelegant and sorta gross.)
A much better approach would be to start a simple html/css based website and start abstracting out common elements, building a templating system, get content from a database, dispatch http requests with a front controller until you've got something that looks like an MVC based system.
Then you start from scratch and do it again, learning from the horrible code you wrote the first time.
Eventually you realize that a framework does it better than you and learn to use rails, zend etc.
Today, I actually hate Wordpress as much as you do. I now use Crowd Fusion whenever possible, but Wordpress's introduction to PHP helped a lot.
Going off the suggestions there, I decided to use the ZEND framework and I've been using the following book: http://amzn.com/1430218797
If you want to build a CMS project, I would highly recommend this book. The examples and code are really easy to follow. Good luck and feel free to email me if you have any questions!
(Note: I did have some RoR experience, but I was completely new to PHP)
EDIT: Curious to know - how does HN feel about starting with the ZEND framework?
1. List of books stackoverflow.com/questions/90924/what-is-the-best-php-programming-book
2. Book tuxradar.com/practicalphp
3. Community and much more phpkode.com
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.
http://www.amazon.com/Learning-MySQL-JavaScript-Step-Step/dp...
It goes through a good amount of material while still being a beginner's book, assuming only that you know a little html. It's very thorough in what it does cover, and should give you enough confidence to decide what you want to learn next, ie, more in-depth PHP, another language, etc.
http://www.amazon.com/Build-Database-Driven-Using-MySQL/dp/0...
It assumes you are comfortable with basic HTML and text editing, and nothing more. In the process of building a basic CMS, you cover pretty much everything you need to know to build whatever you really want to build, as far as the language goes.