Live data from Hacker News

PHP is much better than what you think

fabien.potencier.org

121–130 of 346 posts

Re: PHP is much better than what you think

#121

For reference's sake, this article is written by Fabien Potencier, the creator of the symfony framework. This guy's probably single-handedly responsible for lifting the PHP community to a higher level, by making great software (which, when he started, was pretty unique, with horrible hacks-upon-hacks like CakePHP being the norm), and by showing people how to do so.

A great part of Fabien's work is that he pushes people onto the latest releases. Symfony2 cannot be used without PHP5.3 which is great of keeping people's servers more up-to-date. Frameworks such as CodeIgniter were guilty of keeping compatibility with PHP4 for far too long. The world of PHP is a nicer place if you are on the latest version and are aware of the latest features such as namespaces etc.

It's a double-edged sword however.

Users stuck on PHP 5.2 will miss out on potential security fixes to Symfony 2. This can potential compound an already bad situation.

I'm not saying Fabien didn't have good reasons, more playing Devil's Advocate.

Re: PHP is much better than what you think

#122
To be honest I don't like PHP for exactly the reasons I don't like javascript.

It's easy to write in a way which is stupid.

You can write good php and you can write cool stuff with it. It is easy to non-technical folk to pickup and write a little bit of.

It's also amazingly easy to:

1) Write code which is broken and stupid (woops, left error_reporting(E_ALL) on! silly me. dumped all the passwords out into the website. woops. stabs designer)

2) Write code which is clever, but different from the coding style of every other piece of code in the project (>_> look, my js is so clever, its using closures for everything and events and... oh, you guys weren't doing that? um... ok. Well, now we have some piece of code that only one person knows how to understand stabs self important javascript ninja with spoon).

3) Introduce bugs.

Managing your developers is really the key. If you can keep your php programmers in line, and keep bad code out of your project, php isn't that bad.

...but its that much harder to do when twice as many people are working on the code, and some of them belong to another team.

Re: PHP is much better than what you think

#123

Earlier quoted context omitted.

I keep hearing people mention Facebook as a reason why PHP is a great development language but they compile it down to C++ using their HipHop compiler, and from what I understand they develop Facebook _in spite of_ PHP ( http://www.quora.com/Do-Facebook-engineers-enjoy-programming... )

I got downvoted on another PHP related thread here for bringing that up. Can you truly say they use PHP when they've invested a hell of a lot of money into HipHop to essentially allow devs to write additional PHP code and transform it into C++ binaries? It's a strange way of using it for sure, but it seems to be effective for them.

Right, but Facebook supposedly receives 1 billion new comments + a couple billion likes + a couple hundred million status updates daily, and is probably the largest photo sharing site on the net. Twitter gets about 200 million tweets daily and Reddit has 250 million comments total. Disqus is not much larger than Reddit.

So, since most people here are suggesting Python or Ruby, what real world example can we provide that compares to Facebook in order to make sure that these languages would perform better than PHP?

Neither Twitter, nor Reddit or Disqus are exactly the most stable and performant sites out there. So?

I would say that quick and dirty comparisons like this are meaningless.

Re: PHP is much better than what you think

#124
post #49
post #38

Earlier quoted context omitted.

When I first started looking for work here in Dublin, Ireland a few years ago, I saw tens of PHP web stack jobs, 1 RoR job and no Python jobs. While the tides have turned slightly, PHP web stack jobs here still far outnumber Ruby and Python equivalents, especially at the entry level. Some developers like PHP because they can get easily work doing it. Businesses likes PHP because they can more easily hire people. Argu…

It's a bit of a Catch22 as well. We switched to using PHP for our agency client work because it was easier to hire developers. Not only that, but clients actually ask for it by name (and we lost a number of jobs because we didn't want to use PHP). The cycle continues.

I have to admit that I've turned down potential freelance stuff when the customer requests PHP (or has signed up for a service that only allows PHP).

Of course, I have a full-time job, and the freelancing is usually to pay for a new guitar or something. Your situation is probably different from mine, and needs must.

Re: PHP is much better than what you think

#125

Earlier quoted context omitted.

> "Half baked" Meh. jinja.pocoo.org > "better documentation" By what measure? docs.python.org is just as good (if not better.)

Sorry have to quibble on that last sentence. I'm transitioning from PHP to Python at the moment and I constantly keep thinking "jesus, I wish docs.python.org was as good as php.net".

In what sense? I feel it's better than PHP's docs (tutorial, index, module list, everything.) Besides, you rarely ever need to look at the docs. `help(...)` works well enough 99% of the time.

Method and module names are clear and easy to guess. If I remember PHP well enough, it was a sorry_mess_of_underscored_function_names (with no namespaces) and had $funky $dollar $signs before variables. Some of the functions worked one way, some of them worked in another way (I mean that similar functions didn't work the same way.) Don't get me started on the type coercion system and the equality operators (among other things.)

EDIT: Quite a few people have mentioned that it's easy to deploy PHP software and while that might be true, (as I remember it from when I used to develop in PHP) it's much harder to set up a PHP environment than a Python one. Some of PHP.ini's defaults are (were) horribly broken, Apache has (had) problems finding PHP, etc. In contrast, setting up a Python/WSGI environment is like a breeze.

Re: PHP is much better than what you think

#126

Earlier quoted context omitted.

Yeah - "shit" being the operative word there. The problem I've found is that there's a kind of anti Python paradox at work with PHP: Better than 95% of the PHP jobs out there are horrible scut work for companies that don't give a shit about quality or decent development, even though it costs them an arm and a leg maintaining their steaming legacy codebase. The 5% that you'd actually want to work for need to have a se…

I have not found this to be the case. There are a lot of small/medium sized companies that probably started out with a custom Drupal/Wordpress site and have now out-grown it, but don't want to re-write the whole system just so that they can use Python/Ruby. Using PHP is then a no-brainer and so moving the codebase to Symfony2 is a great option for them. While Wordpress and Drupal command such a large share of the web…

How is moving to Ruby/Python needs a rewrite, but moving to Symfony2 does not?

Re: PHP is much better than what you think

#127

Earlier quoted context omitted.

I'd argue PHP is, for any project of reasonable size, harder to get up and running than say Rails. For any serious development a PHP developer (some experience, did several years of PHP dev) will have to setup a local instance of Apache/ MySQL/ PHP and deal with making sure libraries installed on this dev server match libraries on the production server. When it comes to deployment for both Rails (in this case) and PH…

I'd say setting up Rails or PHP takes pretty much the same amount of time unless you need a really specific custom setup. Plus of course Heroku has simplified it down to git push so setup times are a bit of a given now.

Hahahahaha! No, Heroku has simplified it down to:

- git push

- fix all the stuff Heroku complains about regarding which assets have to be precompiled and where

- repeat until someone who's used Heroku a long time knows your specific problem

Re: PHP is much better than what you think

#129

Earlier quoted context omitted.

Do you have inside info on this? I've seen several people from Facebook comment that they are in fact using PHP. The fact that they're compiling to C++ is a consequence of the slowness of the programming language implementations of those languages that are used traditionally for web development. AFAIK Ruby was and still is the slowest of the bunch.

MRI Ruby is actually significantly faster than CPython these days.

Citation needed. Both CPython and MRI are slow - if you need computational speed, use something else. But when your are comparing them to each other, CPython is faster. I don't know where you are getting that significantly faster bit from.

Since most benchmarks are unscientific, this one is as good as any. So here goes:

http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...

Re: PHP is much better than what you think

#130

Earlier quoted context omitted.

Sorry have to quibble on that last sentence. I'm transitioning from PHP to Python at the moment and I constantly keep thinking "jesus, I wish docs.python.org was as good as php.net".

In what sense? I feel it's better than PHP's docs (tutorial, index, module list, everything.) Besides, you rarely ever need to look at the docs. `help(...)` works well enough 99% of the time. Method and module names are clear and easy to guess. If I remember PHP well enough, it was a sorry_mess_of_underscored_function_names (with no namespaces) and had $funky $dollar $signs before variables. Some of the functions wor…

It's better than PHP docs simply by virtue of being versioned and annotated with version information.
Post reply on HN