TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

15 点作者 koichi超过 14 年前
I'm looking for the best resource(s) to learn PHP, and I have absolutely no idea where to start. Ideally, this resource will:<p>- 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<p>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!

15 条评论

Zak超过 14 年前
Don't. Edsger Dijkstra once wrote:<p><i>The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.</i><p>I'm not sure I'd go quite that far in describing PHP since it actually <i>does</i> 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.<p>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.<p>What do you want to get out of learning PHP? Maybe we can suggest some alternatives.
naithemilkman超过 14 年前
Get a book and just get stuck in. Do all the exercises, do not copy and paste.<p>Search Quora/Stackoverflow/Amazon for recommendations.
评论 #2062893 未加载
tgrass超过 14 年前
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.<p>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.
codeup超过 14 年前
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.<p>As an absolute beginner you could first have a look at these pages: <a href="http://www.php.net/manual/en/getting-started.php" rel="nofollow">http://www.php.net/manual/en/getting-started.php</a> and <a href="http://devzone.zend.com/article/627" rel="nofollow">http://devzone.zend.com/article/627</a> Then you could play around with some code before learning a simple but powerful framework like Kohana or Codeigniter.
venturebros超过 14 年前
Come 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.<p>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.<p>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.
randall超过 14 年前
The 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.<p>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.)
评论 #2063306 未加载
sachitgupta超过 14 年前
I asked a similar question a while ago: <a href="http://news.ycombinator.com/item?id=1697995" rel="nofollow">http://news.ycombinator.com/item?id=1697995</a><p>Going off the suggestions there, I decided to use the ZEND framework and I've been using the following book: <a href="http://amzn.com/1430218797" rel="nofollow">http://amzn.com/1430218797</a><p>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!<p><i>(Note: I did have some RoR experience, but I was completely new to PHP)</i><p>EDIT: Curious to know - how does HN feel about starting with the ZEND framework?
sid02phi超过 14 年前
I am also in the same situation! I googled and found some intresting resource:<p>1. List of books stackoverflow.com/questions/90924/what-is-the-best-php-programming-book<p>2. Book tuxradar.com/practicalphp<p>3. Community and much more phpkode.com
hnhg超过 14 年前
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?<p>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.<p>You might also want to try using a PHP framework like Codeigniter (which is nicely documented), CakePHP or Kohana.
greglockwood超过 14 年前
When I decided I wanted to learn coding, this is the first book I purchased, and I can't recommend it enough:<p><a href="http://www.amazon.com/Learning-MySQL-JavaScript-Step-Step/dp/0596157134/ref=sr_1_2?ie=UTF8&#38;s=books&#38;qid=1294110146&#38;sr=8-2" rel="nofollow">http://www.amazon.com/Learning-MySQL-JavaScript-Step-Step/dp...</a><p>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.
dangrossman超过 14 年前
I'd recommend this book:<p><a href="http://www.amazon.com/Build-Database-Driven-Using-MySQL/dp/0980576814/ref=dp_ob_title_bk" rel="nofollow">http://www.amazon.com/Build-Database-Driven-Using-MySQL/dp/0...</a><p>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.
AdamGibbins超过 14 年前
Do you have experience in another language or is this your first? Any CS knowledge?
orenmazor超过 14 年前
this 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?
IsaGoksu超过 14 年前
Don't learn.. If you are gonna learn something, learn ruby or python.. PHP is a dead-end..
pclark超过 14 年前
Hack around with wordpress.