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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Between PHP and Python, which one is better for web programming purpose?

3 点作者 reazalun超过 16 年前
I've a decent knowledge in JavaScript. Now I want to do a more serious web programming. I want to learn both PHP and Python. In your opinion:<p>1) Which one should I learn first? PHP or Python? 2) Which language has a better prospect in terms of web programming?

9 条评论

jm4超过 16 年前
They will both get the job done. PHP isn't exactly pretty but it's easy to learn and get up and running with. Python can also be learned fairly quickly but it might be a steeper learning curve getting your development and production environments set up properly. I would definitely give the edge to Python since it's much more general purpose than PHP is. You may not always want to do just web programming.
icey超过 16 年前
I'm not going to speak at all to which language is better. As far as I'm concerned, if you're developing for the web they both have their pros and cons.<p>That being said, learn Python; if anything so you don't have to hear smarmy language snobs go on and on about how PHP is terrible.<p>On a deeper level, I would seriously consider taking some source code from each and pasting it into the editor of your choice. Then maximizing each one side by side and consider how staring at each one makes you think about working in it.<p>I know it's a bit fruity, but I like to think about it as code Ikebana. I'm only a little embarrassed to admit that I've made more than a few code decisions that way.<p>[Edit: I'm a smarmy language snob, so feel free to ignore this advice :D ]
smoody超过 16 年前
Q: Are you or might you take the application open source with the hopes of being the next Wordpress, Drupal, or SugarCRM?<p>A: PHP -- simply because it's so easy for people to install and run PHP apps. At this moment in time, I think almost all of the 'breakout' open source apps have becomes breakout hits in part because they're written in PHP.<p>You can do quite a bit in PHP. Facebook's FBML parsers are written in PHP and Flickr's home-brewed queue-based background processing system is written in PHP. Yes, PHP is difficult to stare at all day because of the $,-&#62;,=&#62;,@, and ; (and soon /), but it's a perfectly fine language otherwise.<p>Python would be my choice if my web app required a lot of algorithmic work. If, for example, I was performing a lot of text analysis, I'd choose Python. They have a number of built-in operations and operators that make it easy and concise to do such things. I believe that the original Google spiders were written in Python. And there are numerous libraries for do statistics, advanced math, and such things in Python. If your web app can be built on-top-of Google's App Engine and doesn't require https (assuming you use your own domain name), then that might be a good place to start.
kamme超过 16 年前
Well, being a php developer and doing some django (django is a framework builth with python) I can honestly say that there is no clear answer.<p>If you just want to learn 'something' and not do any real project, by all means, learn python. Python is a great and easy to learn language that lets you make great programs, and not only webbased ones! Python is a very well supported language, it runs on linux, mac and windows so you can use it wherever you want.<p>If you just want to make a website for yourself and don't want to spend too much money, I suggest you use php. If you want I am sure you can find some webhost that offers you some webspace + domain name for around 20$. Will that be a very good webhost with lots and lots of space/traffic? Probably not, but I'm pretty sure it will enough you for some time. And besides, if you find out php you're not into making websites, you can have a wordpress blog up and running in about 5min, without any php coding required.
thorax超过 16 年前
Short answer: If you love coding, learn Python. If making web apps is just a means to an end for you, learn PHP (and a framework like Code Igniter).<p>Long answer: If you want to code web apps primarily for the forseeable future, go with PHP and a great backend framework like Code Igniter.<p>If you want to eventually code larger scale backend pieces, and grow into other areas of development, go with Python.<p>I love Python, but have a renewed loss of skepticism for PHP given how well CodeIgniter has performed for some of our major web apps. I personally feel Python doesn't feel as inherently interconnected with web concepts as PHP, so there are more complications/hurdles to get past in order to build a 100% functional/pretty web app. But you'll be much better off long-term for learning Python if you're going into sysadmin/backend/app development.<p>I love coding, so I learned both. Good luck!
mikeryan超过 16 年前
It doesn't matter.<p>Both work quite fine, PHP is more web-centric. Its not used so much for scripting or even some desktop apps like Python is. But if I was going to make an off the cuff assessment I'd say its better for web development just because its so huge in the space.
run4yourlives超过 16 年前
The answer to your first question is Python. It's a better language hands down, and you'll be a better programmer for knowing it.<p>Now, I'm not a language zealot so I'll answer your second question a little differently. It really depends on how you define "web programming". If your goal is to hack together a few scripts for standard websites, PHP is a nice easy language that you can learn quickly. If you're more interested in web applications, python will be the better choice for you in the long run.
yan超过 16 年前
Why choose? You can pick up enough PHP or Python to be proficient in a day, each. Just learn enough to be able to read code in both and figure out which one you want to be writing for the majority of the day.<p>In the end, what's important is how comfortable you are writing code in that language. Large systems and sites have been created using both.<p>Personally, I like Python more for both web and general programming, having used both.
jcapote超过 16 年前
That's a tough question, since they are the two languages I detest the most. I'd go with python/django, simply because it's better than php/mkdir.
评论 #372232 未加载