Hacker News new | past | comments | ask | show | jobs | submit login

Are the complaints about PHP even controversial? The built in library functions are a mess, and mostly terrible. The syntax and basic language are overly verbose and have layers upon layers of cruft. The type and object systems are grafted on, and have so many gotchas and inconsistencies that it takes many months to understand enough of them to be very productive in the language. The aspects of PHP that were intended to make it simple (like pretending types don't exist) actually make it more difficult to reason about precisely. I don't think anyone who knows anything else would ever choose PHP for a fun personal project.

Despite this, there is nothing in PHP that prevents you from doing the thing you want to do, however you want to do it. As projects become larger and involve more time and people, the fine grain of line syntax fades out of view, and all that is left is the large scale design decisions, which are similar in any language. And this is what ultimately determines the technical success or failure of software.




I code in Python, BASH, C, and PHP on a regular basis and still strongly prefer PHP for everyday coding and hobby tasks. I even prefer to create command-line scripts in PHP (though will switch to Python if it's large to begin with). For me getting Flask to work properly under NGINX + uwsgi was such a hassle. Having to tell it what module, and hooking things up to touch versus just passing to PHP under fast cgi.

To be honest, PHP is really just simpler, less hassle, and if you know what you're doing things come out structured well. Just stick to classes (Including statics! There shouldn't be a define() anywhere.), use namespaces, use composer (I've come to really like it), and use a coding standard.


In what ways is PHP less hassle than Python? I don't understand this argument.


Deployment, for one. sudo apt-get install Apache and PHP, then edit the Apache config to say, "use this directory." I love Django and Flask to pieces, but deploying a Python app is like building a hovercraft compared to PHP.


I have no problems deploying a django app with gunicorn. It's a simple command line statement, and deployment is always an intricate thing, unless you don't have to worry about ssl certs and secrets and keys, and managing access, admin pages, etc etc.


Which you usually don't for fun personal projects.


I'm going to say it, better documentation. I don't know, maybe it's just me, but I find it takes me significantly less time do find out how to do something in PHP, or a PHP library than in the corresponding Python. Though, there are obviously exceptions to this.


Ooh, yes. While PHP's docs sometimes promose horrible worst practices, they are more detailed and fleshed out than Python's.


Abstract classes in Python are kinda bolted on http://docs.python.org/2/library/abc.html

They're native to PHP http://php.net/manual/en/language.oop5.abstract.php


Abstract classes are unnecessary and "unpythonic", if you will; there's a lot of other preferred patterns in Python for that use case.


I don't think it's less of a hassle than PHP, but in the context of web development, it is. In PHP, your development environment is often very similar to your production environment.

I think the primary difference is PHP is web first: it was designed to be a language for the web above all. Everything else is tacked on. On the other hand, Python is useful for a whole array of problems and a website is just one problem you can solve with it.


> I don't think anyone who knows anything else would ever choose PHP for a fun personal project.

I would. For every job, a proper tool. If my project is client-side heavy and only needs a thin layer between the client-side and the database, I'll pick PHP. The code I would write in PHP would be minimal and I would get it up and running very quickly.

If I'm writing something substantial on the server-side, then yeah, you may want to consider something else.


I think it's exceptionally easy to become productive in PHP quickly and to reason about the code despite all the warts and gotchas. The good points about PHP raised in the slides (statelessness, etc.) hugely simplify thinking about code, offsetting the bad stuff and then some.

Doesn't make me want to give up python or node, but these are strong points in PHP's favor.


But with so much frameworks around it is a relief to have the complete control and library support. I am talking about plain PHP.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: