views:

333

answers:

6

Python or php which language would be better for web development?

A: 

What are you developing?

(how long is a piece of string?)


That said, PHP is a very accessible language for Web Development and extremely popular among many large open-source projects like WordPress. The system has evolved it's own object-oriented methodology and is an excellent way to start learning to develop data-driven applications for the web. It's also very forgiving.

kdmurray
+2  A: 

PHP is a more popular language in the web development community, currently. On the other hand, Python itself is a cleaner language that promotes better programming style and is much more popular than PHP outside the web development world.

So if you plan to do any other sort of coding (including scripting, automation, stuff every programmer needs), I'd suggest to go with Python if you only want to learn one language now. Even though PHP is more popular, Python is catching up and has great libraries and communities for web programming.

P.S. This is my personal, subjective opinion, of course. I've also added the subjective tag to your question because it belongs there.

Eli Bendersky
Check out www.djangoproject.com , Django is basically the Python equivalent of Rails but cleaner and less 'magic' than Rails is.
Soviut
A: 

An advantage of PHP is that really every cheap webhosting service will allow you to run your PHP scripts. If that is not an issue, I'd go with Python, as it is generally considered a "better" language, and can be used in many different situations, unlike PHP.

panschk
Being able to be used in many different situations is arguably a disadvantage. A language that's well designed for a particular task will typically be "better" than a general purpose langauge at that task, which is the impetus behind DSLs.
cletus
+1  A: 

I agree with eliben. A lot of existing projects are done in PHP and it has become the language of the web.

However its really easy to write bad code in PHP. Python is a more natural language, also very interesting and stimulating to program in. There are also many good web frameworks that help with whatever you need in web development is. (Django, Pylons, Turbo Gears and others)

Also don't count out Ruby, Java, and .NET as alternatives depending on the need and the programmers involved. `

Doug.Tabuchi
A: 

If those are your only two options, I'd say "whichever one you're more comfortable working in". Both languages are about equal in the web development world, IMO -- PHP's got the "web heritage" and ubiquity on it's side, while I think Python's a slightly better language overall.

Don't disregard the alternatives, though -- Ruby on Rails is by far the best web application framework I've ever used, and the Ruby language itself is beautiful. .NET and the rest of the proprietary world are apparently pretty nice in their own way, too.

womble