Live data from Hacker News

Ask HN: Why no love for PHP?

news.ycombinator.com

111–120 of 150 posts

Re: Ask HN: Why no love for PHP?

#111
post #73

Earlier quoted context omitted.

It's not just the experience. Languages like Ruby and Lisp tend to be a lot more concise and have more functionality than PHP, so it's more like comparing a blunt knife to a razor sharp one. You can still cut with a blunt knife, but it takes longer and is harder work.

You're kidding right? You're claiming that Lisp has more 'functionality' than PHP. By functionality, do you mean standard library? Or do you mean core language? Elegance != more functionality.

My apologies, "functionality" isn't a very precise word in this case. I meant it in terms of what functionality is in the language's syntax. For instance, Lisp has macros whilst PHP does not. And whilst later versions of PHP do support things like first class functions, they do so in an unwieldy and verbose fashion that negates a lot of their advantages:

    #(* n %)

    (* n _)

    (* n)

    function($x) use ($n) { return $n * $x; }
One of these things is not like the others :)

Re: Ask HN: Why no love for PHP?

#112
post #68

Earlier quoted context omitted.

It's not just the experience. Languages like Ruby and Lisp tend to be a lot more concise and have more functionality than PHP, so it's more like comparing a blunt knife to a razor sharp one. You can still cut with a blunt knife, but it takes longer and is harder work.

I would argue that PHP and the LAMP stack have more functionality than any other language by an order of magnitude when you're talking about web development tasks. For anything else, PHP is pretty much irrelevant, but when you're doing web development, it's definitely the swiss army knife. Without a single import or require, you can send emails, query a database, download a web page, handle session data, get post var…

I tend to think in terms of language design, so by "functionality", I meant it in terms of syntax, rather than external libraries. Sorry, I should have been more clear.

Re: Ask HN: Why no love for PHP?

#113
post #34

There are lots of reasons. * PHP attracts idiots. Partly that's because you don't need to know anything to make simple PHP. So, in the large pool of PHP programmers, there are a ton of idiots. And those idiots produce a lot of verbose code that gets used because it does something. Ruby, Python, Perl, etc. all put up a larger barrier because they don't just come with a session handler or whatnot built in. And that wee…

I can't say I love PHP, but some of your criticisms are a little silly. For example, about typing... your argument is that when you cast a string to an int, it returns 0. What would you have it return, null? Typing is jank in a number of ways, but in most cases I See the logic in the original decision. To a noice, the idea that false == "false" (because "false" casts to 0) but true != "true" just seems broken. But wh…

[deleted]

Re: Ask HN: Why no love for PHP?

#114

In the past I've purposefully avoided submitting articles to Hacker News if they were about PHP. I kind of just assumed that they would be downvoted just for being PHP. I wonder if I'm alone in that? Edit: fixed a typo.

If the submissions were quality I would definitely upvote them.

I use PHP as well.

Re: Ask HN: Why no love for PHP?

#115

People who are really good at their jobs obsess about their tools- artists obsess over their paint, carpenters obsess over their power tools, cooks obsess over their knives. PHP is like buying a chef's knife at Wal-Mart. You can create a 5 star dish with it, it cuts perfectly fine, but it doesn't inspire the same passion that a Shun knife does. Most restaurants in fact, don't use fancy-knives, they use just regular k…

">People who are really good at their jobs obsess about their tools- artists obsess over their paint, carpenters obsess over their power tools, cooks obsess over their knives.

Most people do this about things they seriously care about. Runners debate intricacies of running shoes or the perfect in race meal."

And yet one of the most grueling races in the sport of running, the 100 mile, 10000ft altitude Leadville 100 has been won more than once by a man not wearing true shoes at all.

This isn't an isolated example, either. Many masters of many fields focus on their skills rather than their equipment. Often those with the most expensive golf clubs, are those trying to compensate for a lack of skill. The same is true of photographers an their cameras. Miyamoto Musashi even went so far as to regularly arrive at duels with a wooden sword.

Tools can give someone an edge, but IMHO they aren't the right place to focus one's obsession.

Re: Ask HN: Why no love for PHP?

#118
For all its flaws, PHP and Perl are the only web languages that let you build a web app in _whatever_ fashion you want.

This extreme flexibility coupled with mature libraries makes web app development ridiculously easy. For a complex application that starts at ground zero I would probably recommend Ruby or Python but really even that decision is 50-50. We've faced this crossroads 3 times in the last couple months and 2/3 we've gone with PHP over Python, and not just cos of familiarity.

For any existing app, it's probably already in PHP or something worse like ColdFusion, so migrating it to "good" PHP 5.x is usually the only logical step.

That said threading, namespaces, sickening magic and the whole haystack/needle needle/haystack game SUCK. But you can get everything done quick and everything will scale and if you need to change it you know you always can without tearing down a house of cards so ... I for one don't mind it, in fact I quite like PHP and the PHP ecosystem.

Re: Ask HN: Why no love for PHP?

#120
post #45

Earlier quoted context omitted.

Languages are like tools: buying a the best set you can afford is the best possible start to a project. PHP doesn't cause SQL injection flaws, but it doesn't make it any easier. How many escape functions are there ? Shall we count them ? ---------- mysql_escape_string() - Escapes a string for use in a mysql_query mysql_real_escape_string() - Escapes special characters in a string for use in a SQL statement mysqli_rea…

I think this comment sums it up nicely: http://blog.ianbicking.org/php-ghetto-comment-11.html It basically argues that in PHP there's often an easy, insecure way to do something and a verbose, secure way to do it. With regards to SQL injection, Java is the same way; prepared statements are much more verbose and annoying than string concatenation.

I regard string concatenation as very annoying in Java.

Actually, just about anything is annoying in Java. I guess I have been spoiled by more modern languages like... Smalltalk/80 or Lisp'56.

Post reply on HN