68 ms·
> Nobody mentions how much or little the PHP community thrives. People point out how bad PHP compares against other languages. I don't actually think that faul
by adamors 12y ago
> Nobody mentions how much or little the PHP community thrives. People point out how bad PHP compares against other languages.
I don't actually think that faults in a language matter that much if the people using it are competent. Both Javascript and Perl come close to PHP in terms of negative traits, yet a lot of good software was written with both. The same can be said about PHP, the only difference is that people on HN have very little idea about what contemporary PHP (language and software) looks like.
- lern_too_spel 12y agoJavaScript is a horrible language. The fact that a lot of good software is written in JavaScript because there is no good alternative in the browser does not make it any less a horrible language. The problem with PHP is that it is a horrible language and there are plenty of better options in its niche. Those two factors combine to make PHP a nonstarter for programmers who are familiar with the other options. I dispute that there is any good software written in Perl.
- jafaku 12y ago> I dispute that there is any good software written in Perl. Do you even Linux? Have you ever installed anything? If you pay attention you will notice that lots of the libraries you are using for everything are written in Perl.
- meowface 12y agoThere are many good PHP web frameworks out there today, yes. These don't somehow erase PHP's core flaws as a language though. You can make a new project in Symfony or Laravel, sure, but you'll get that same niceness plus way more goodies if you use a popular Python or Ruby framework.
- debaserab2 12y agoI think you need to qualify that a bit - what are "way more goodies" exactly? Can you name something that Python can do that PHP can't?
- meowface 12y agoNo, but I can name a lot of things that are way easier and cleaner to do in Python than in PHP.
- debaserab2 12y ago> No, but I can name a lot of things that are way easier and cleaner to do in Python than in PHP. Please do.
- chipotle_coyote 12y agoI can name two. First, list comprehensions. In PHP, what you might write as this: $image_urls = []; foreach ($images as $image) { $image_urls[] = 'illos/' . $image['url']; } can just be this in Python: image_urls = ['illos/' + x['url'] for x in images] And, closures in Python -- and to be fair, just about any language that isn't PHP -- close over variables in the scope they're defined automatically, without having to use PHP's strange "use ($a, $b, $c)" construct. Yes, that's a small thing, but PHP's way is a little bonkers.
- porker 12y ago> can just be this in Python: In PHP 5.3+ you can write: $image_urls = array_map(function($image) {return 'illos/'. $image['url'];}, $images); Not as concise, but I'd postulate easier to read for people not familiar with list comprehensions. In PHP 5.5+ there may be another way, but we're stuck with 5.3 in production for most clients, so I'm not up to speed. > And, closures in Python -- and to be fair, just about any language that isn't PHP -- close over variables in the scope they're defined automatically, without having to use PHP's strange "use ($a, $b, $c)" construct. Mmm, the debate of explicit or implicit scope? Explicit at least gets round those strange errors (hello Javascript) where you think you're referencing one thing... and actually referencing something else.
- philjohn 12y agothis (javascript pun intended)