Live data from Hacker News

PHP: the quiet powerhouse

blog.appfog.com

91–100 of 140 posts

Re: PHP: the quiet powerhouse

#91

Back when all you had for choices were Perl, Java, and C++ it was easy to see why PHP got big. However there are issues with starting out on PHP now: 1) It's really only meant for web development. 2) There are other languages now that are simple to learn, flexible (more than just for web apps), and powerful (Python, Ruby, and now even Javascript) Unless PHP has another major evolution, like its move to OO; (or unless…

I've been working with PHP since 1996 and rarely see eval being used. I've worked with hundreds of companies training PHP developers, seen inside (and written) some very large codebases handling millions of dollars of transactions, and don't recall seeing eval in any of them.

"it was easy to see why PHP got big"

It's easy to see why it's staying big:

1. cheap shared hosting to get started 2. most hosts offer one-click installation of any sort of application people need on the web (blogs, shopping carts, calendars, social networking, file hosting, etc) 3. 15+ years of knowledge about what works and what doesn't when attempting to scale PHP to large needs. 4. ubiquity which keeps a large pool of reasonably priced talent available, which perpetuates the cycle.

When there's a competitive language that can be placed in a directory as FOO.abc, I can hit it as /FOO.abc and have it execute, with html content type sent by default, it'll have a running jump at dethroning PHP.

The barrier to entry is the lowest out there, but the heights it can scale to are facebook-level and beyond.

Re: PHP: the quiet powerhouse

#92

Here's an idea.. If PHP is so bad.. Don't use it. Simple as that. Let the people who want to use it... There's absolutely very minimal things wrong with the language. Everyone's quick to compare it with Python or Rails or something else saying "PHP does this wrong that Python does right" well, if PHP did everything the same way as Python, Rails, or something else, when what makes it different? Who wants to use a lang…

Some of the problems with PHP are things that are problematic or irritating to development (e.g. its inconsistent standard library) but other things are actively dangerous to security and correctness. For example, in PHP, '9223372036854775807' == '9223372036854775808' returns true.[1] Now imagine those two strings are hashed passwords.

The overall problem is not with specific flaws of PHP; the problem is that flaws in a language lead to errors in programs written with that language, and when that languages is used to write some kind of web infrastructure, then use of that language by people less than experts (i.e. almost everyone) is harmful to the whole internet. PHP can be used to write useful, scalable, secure web apps in the hands of someone who knows what they're doing, but in the hands of someone who doesn't quite know what they're doing, or who does but is tired enough to miss individual details of their code, it is much more dangerous than other comparable languages.

That is why I discourage the use of PHP if possible.

[1]: https://bugs.php.net/bug.php?id=54547 (Both strings appear numeric, so they are casted to numbers before the comparison, but because they are larger than maxint, they are rounded down. The solution, if you really must use PHP, is to use === instead. The fact that a solution exists does not mitigate my concern.)

Re: PHP: the quiet powerhouse

#94
post #85

Here's an idea.. If PHP is so bad.. Don't use it. Simple as that. Let the people who want to use it... There's absolutely very minimal things wrong with the language. Everyone's quick to compare it with Python or Rails or something else saying "PHP does this wrong that Python does right" well, if PHP did everything the same way as Python, Rails, or something else, when what makes it different? Who wants to use a lang…

> There's absolutely very minimal things wrong with the language. I guess you missed this post that highlights a few of them: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... I agree on using what you enjoy using, but implying PHP isn't riddled with flaws is absurd.

I guess you may have missed the accompanying HN thread (http://news.ycombinator.com/item?id=3820431) where quite a few of the article's claims were challenged/rebuffed.

Re: PHP: the quiet powerhouse

#95
post #85

Earlier quoted context omitted.

> There's absolutely very minimal things wrong with the language. I guess you missed this post that highlights a few of them: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... I agree on using what you enjoy using, but implying PHP isn't riddled with flaws is absurd.

Just like Python, Perl, Rails, Node.js, and any other language out there. Why all the hate towards PHP?

"Rails" isn't a language, and PHP has fundamental design flaws that those other languages don't have. It's not that it has flaws, it's that it has unavoidable flaws.

Re: PHP: the quiet powerhouse

#96

I have a few nits with this post, but am mostly irked by the comparisons between PHP (a language) and Rails (a framework)

You're quite right that the analogy isn't perfect. The point I was trying to make, though, is precisely that PHP development can proceed without any recourse whatsoever to a framework. Jumping straight into web dev without an accompanying framework like Rails or Sinatra is a complete non-starter if you're a Rubyist. So you're quite right, but I hope you would agree that the Rails/PHP comparison, in spite of its imper…

I got my start with Ruby web development using ERB in a CGI script. Same with Perl before and Python after. The option to do that has not been taken away.

Re: PHP: the quiet powerhouse

#97

I think people are comparing apples to oranges. Ruby on Rails is as some have stated, a framework, much like Zend or cake or CodeIgniter. I think the author is spot on in this post. PHP is not without its warts, but as a programming language for web development, it is scalabe, reliable and robust. Can you perhaps do things faster or more elegantly in other languages? Sure, but writing good clean code is really in the…

"Scalable" and "reliable", perhaps. "Robust" actually means something, though, and PHP is not it. Its wretched approach to error handling prevents that.

Re: PHP: the quiet powerhouse

#98

> But I also think that it might be the best language to use in gaining an understanding of the fundamentals of web development OP admittedly has less than one year of web development experience. Perhaps it would be wise for OP to gain a more thorough understanding of web programming before coming to conclusions like this.

I use words like "might" very intentionally! And yes, right you are that my conclusions about things might change radically. I'm already appalled at some of the things that I thought even weeks ago...

Re: PHP: the quiet powerhouse

#99
post #58
post #48

Earlier quoted context omitted.

"gets shit done very very quickly" In what way does PHP help to get things up and running faster than other languages?

Have you used PHP? Spend 5 minutes with it and you'll understand; a very expressive language, simple to learn, massive library of functions, massive number of examples to copy, no framework to learn, no syntactical overhead like in Java, practically everything works with, or has bindings for PHP. I prefer to work in python, but I don't much care anymore, each language has it's strengths and weakness' but PHP most def…

[deleted]

Re: PHP: the quiet powerhouse

#100

Here's an idea.. If PHP is so bad.. Don't use it. Simple as that. Let the people who want to use it... There's absolutely very minimal things wrong with the language. Everyone's quick to compare it with Python or Rails or something else saying "PHP does this wrong that Python does right" well, if PHP did everything the same way as Python, Rails, or something else, when what makes it different? Who wants to use a lang…

Some of the problems with PHP are things that are problematic or irritating to development (e.g. its inconsistent standard library) but other things are actively dangerous to security and correctness. For example, in PHP, '9223372036854775807' == '9223372036854775808' returns true.[1] Now imagine those two strings are hashed passwords. The overall problem is not with specific flaws of PHP; the problem is that flaws i…

Agreed on what you said about writing scalable, secure web apps. No question about it.

But I should say as an aside (and you wouldn't necessarily disagree, I don't think) that these kinds of problems are not exclusive to PHP. JavaScript gets you exactly the same result. And try doing something as simple as 0.2 + 0.1 in JavaScript. Oy vey...

Post reply on HN