Live data from Hacker News

PHP is much better than what you think

fabien.potencier.org

101–110 of 346 posts

Re: PHP is much better than what you think

#101

Earlier quoted context omitted.

Have you written a production app for PHP in the last 5 years? It handles (out of the box) multibyte encodings, locale-aware number and date formatting, parameterized prepared statements for your SQL, etc as well as most any language.

I'll be intellectually honest and admit that, no, I haven't really touched PHP for anything near a production app in the last 5 years. But to be absolutely clear: before PHP used to be the only language I wielded for money. I have enough lines of PHP on my back to claim the right to an opinion. That said, last time I looked into PHP, modus operandi seemed to being focusing on making things easy, not making it easy to…

The PHP interpreter is much like any other compiler or interpreter. It will halt on errors. It will, by default, output warnings/notices for things like accessing uninitialized variables. Like any other compiler or interpreter, you can tell it to hide warnings, or to halt on warnings, or to log them somewhere instead of outputting them. What makes this a fundamental weakness of the language, but not of, say, C, where gcc will also happily compile code no matter how many warnings it runs into?

Re: PHP is much better than what you think

#102

Earlier quoted context omitted.

I'll play devil's advocate here. Define "proper"? Does meeting a business need, bringing in money, putting food on the table, and paying the rent mean "proper"? If not, why not? PHP has a plethora of flaws, but it's still a serious tool and used to build creations of significant value, that can't be ignored. As far as quality, what platform do you use to guarantee quality? I've heard many stories about terribly broke…

By "proper" I mean building a piece of software which has a clean and maintainable implementation, logical semantics, proper encapsulation, and last but not least, which is solid . That is, should be able to withstand real world challenges and input-data without crashing, failing, silently failing, creating corrupted data or any combination of those things. Granted, it's been quite a while since I've done PHP, and it…

Right. So by your definition there are no good platforms to write "proper" web applications in, since it takes a lot of special effort to avoid all of those problems in any language (ruby, python, c, c#, java, node.js).

Re: PHP is much better than what you think

#103

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.

Re: PHP is much better than what you think

#104

Earlier quoted context omitted.

Spot on - you nailed it. The end user counts here, big time. A lot of the products out there would have precisely zero traction if they required literally hours of piddling around. If you compare it to JVM based commercial offerings, and I'll pick Crucible as an example here, it requires: 1. Find a working JVM that matches it. 2. Piddle around with PATH settings and JAVA_HOMEW. 3. Unzip it. 4. Lots of database config…

The funny thing is that if you do care about nginx and fastcgi you can get blazing fast high-volume/low-overhead php hosting with varnish + nginx + php_fpm.

Not to be a hater, but what's funny about that? The point is exactly that. Most people don't care about "blazing fast".

Re: PHP is much better than what you think

#107
post #17

Earlier quoted context omitted.

Honest question: Do you have more than a months professional experience writing modern PHP? While I love appreciate the Java ecosystem with amazing stuff like Play framework, Scala, Camel (several apache sub projects actually), Python micro frameworks etc there still is something magic about PHP. I still haven't made up my mind but there is something about really fast turnaround time, transparency, and shared nothing…

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.

Re: PHP is much better than what you think

#108
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…

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 website market, there will always be decent young companies emerging who are also tied-in to the PHP community.

Re: PHP is much better than what you think

#109
post #12

I'd stay away from a language that has function names like array_keys or allows you to write array("a" => "green", "red", "blue");

What's wrong with array_keys? It's extremely useful.

Java has keySet(), Ruby has hash.keys, etc.

Your second argument is even dumber. Yes, PHP lets you do lots of things, which improve the speed of development. If you don't like it, don't write it that way.

Re: PHP is much better than what you think

#110

I am not convinced. My argument is not that PHP sucks or that anything else. It is rather that PHP is lexically tied to corner-case development. In that case PHP is very good at some things but not really all that great for others. PHP started out as being a pre-processor for SGML documents. All PHP code is contained inside SGML program instruction tags. PHP has never changed this, so however it has developed it is s…

You've heard of PHP SAPIs right? You can most defiantly use PHP outside of a "web environment". I have PHP daemons managing the sending of email and sms, and another used to manage incoming data that is fed into our local database. These have all ran for years (7+) with no issues.
Post reply on HN