4 ms·
Ask HN: What's the best way to start learning PHP?
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!
- naithemilkman 16y agoGet a book and just get stuck in. Do all the exercises, do not copy and paste. Search Quora/Stackoverflow/Amazon for recommendations.
- codeup 16y agoSounds good as a resolution, but sticking to a book may not work for all.
- naithemilkman 16y agoYeah, I found Youtube videos very helpful as well. If you know where to look, you can find Lynda.com videos around too..
- codeup 16y agoThere 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 http://www.php.net/manual/en/getting-started.php and http://devzone.zend.com/article/627 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.
- Zak 16y agoDon'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.
- AdamGibbins 16y agoDo you have experience in another language or is this your first? Any CS knowledge?
- deleted 16y ago[deleted]
- hnhg 16y agoYou 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.
- tgrass 16y agoI 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.
- sid02phi 16y agoI am also in the same situation! I googled and found some intresting resource: 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
- randall 16y agoThe way I became a journeyman PHP-er was to mess around with Wordpress. There are enough resources out there that Wordpress will give you the basic knowledge. 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.)
- alinajaf 16y agoThis is not an attack on you personally but I absolutely abhor the inner workings of wordpress and would thoroughly recommend against it for a beginning developer. 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.
- randall 16y agoFor me, it was really about speed. I used Wordpress because I could learn it quickly and I had a modified blog (my goal) as quickly as possible. I didn't have to worry about learning how to connect to a DB, 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.
- venturebros 16y agoCome up with an idea for a project and write down the process. For instance say I want to build something like HN. I would write down something like I would want all post titles displayed , if someone clicks on the link display the entire post. Not sure if that makes sense but writing it down especially if it is a complex project you have in mind will help you see the flow of things and will make coding it a bit easier. 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.
- pclark 16y agoHack around with wordpress.
- orenmazor 16y agothis is a good question. why is there a bunch of fun challenges/books for python, and a bunch of fun books for ruby, but with php everybody just laughs at you?
- dangrossman 16y agoI'd recommend this book: http://www.amazon.com/Build-Database-Driven-Using-MySQL/dp/0980576814/ref=dp_ob_title_bk 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.
- sachitgupta 16y agoI asked a similar question a while ago: http://news.ycombinator.com/item?id=1697995 http://news.ycombinator.com/item?id=1697995 Going off the suggestions there, I decided to use the ZEND framework and I've been using the following book: http://amzn.com/1430218797 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?
- greglockwood 16y agoWhen I decided I wanted to learn coding, this is the first book I purchased, and I can't recommend it enough: http://www.amazon.com/Learning-MySQL-JavaScript-Step-Step/dp/0596157134/ref=sr_1_2?ie=UTF8&s=books&qid=1294110146&sr=8-2 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.
- IsaGoksu 16y agoDon't learn.. If you are gonna learn something, learn ruby or python.. PHP is a dead-end..