7 ms·
This article is important because there are still so many people who talk about how bad PHP is, based on their knowledge of some version from years ago. There
by jmadsen 13y ago
This article is important because there are still so many people who talk about how bad PHP is, based on their knowledge of some version from years ago.
There was (another) recent Ruby vs. PHP Bashfest some months ago that was essentially:
"PHP sucks. It can't do X...oh, it can? Well, it can't do Y...oh, it has been able to since 3 major release ago..well, it can't..."
PHP is far different than you probably think it is. I also can't help but feel that a huge number of they people who naysay it are only parroting things they don't even understand - I rarely hear them explain precisely why such and such quirk in the language is bad for programming
- egeozcan 13y agoI mostly agree with you. The awkward syntax and a nightmare API is here to stay for backward compatibility though. The most important point is, there are a lot of languages which are better than or at least on par with PHP on every aspect you can think of. PHP is definitely not a disaster, but everybody just need to move on.
- Killswitch 13y agoNobody needs to move on. PHP is here to stay and isn't gonna disappear anytime soon, it controls a large portion of the internet, if you don't like it, don't use it. Nobody is forcing you to use it.
- rbanffy 13y agoNobody needs to move on from COBOL. It's here to stay and isn't going to disappear anytime soon. It runs a large portion of all financial operations. If you don't like it, don't use it. Nobody is forcing you to.
- Killswitch 13y agoGood. I'm glad you're catching on. Next step is to learn that all languages have their strengths and weaknesses and your personal preference means nothing to anyone but you.
- egeozcan 13y agoNow, this is not really an argument but more of an emotional response, isn't it? What I see is that PHP is already losing popularity by every passing day. How many newbie developers are starting with PHP these days? Why would they? It's not as bad as people make it to be but there are just too many better alternatives, which are also easy to learn. I honestly don't get this kind of defense.
- Killswitch 13y ago> What I see is that PHP is already losing popularity by every passing day. And where are you observing this at? I hang out in PHP communities and I am seeing more and more new faces daily. Lots of new people starting with PHP because of it's easy use and the fact that the most popular open source projects to get your site off the ground are PHP based.
- egeozcan 13y ago...with just too-many-to-count alternatives. Those projects are also usually not for seasoned programmers. Who uses Drupal for anything serious these days, apart from maintaining it? What is the user-base for Wordpress? Take a look here: https://github.com/trending https://github.com/trending , How many are written in PHP? It just doesn't make sense to start something new with PHP unless your existing code-base is written in it.
- eevee 13y agoPHP's worst problem is an exacerbated form of what strangled Perl for many years (and still does, though they're actively fighting it): lots and lots of existing code that's really, really bad. Adding new features doesn't help that. Only gradually deprecating old ones (or waiting a few decades) does, and that doesn't seem to be in PHP's blood.
- stephenr 13y agoDeprecating unsafe/"bad" features is not "in PHP's blood" ? Have you even read a PHP changelog recently?
- eevee 13y agoPHP has deprecated obviously insecure behaviors that are largely Web-related, yes. I'm coming from a Perl perspective, where deprecating bad language features means things like "radically overhauling how variables work" or "putting major community effort into eliminating an entire kind of variable". I'm not aware of many similarly-radical changes in PHP, except perhaps whatever happened with PHP 4's short-lived classes.
- stephenr 13y agoRadically overhaul how variables work? Im not sure i even understand what that is supposed to achieve? Make them not variable any more? You're suggesting self-proclaimed radical changes but not giving any information about the actual advantages?
- eevee 13y agoAh, sorry, some actual context might be helpful. In Perl, variable declaration was originally even worse than it is in PHP: any variable, anywhere, required no declaration and was assumed to be a global. (This was inherited from... some combination of awk and shell, I guess.) Obvious problems aside, a practical implication was that recursion was pretty awkward, since the callee and the caller were sharing the same namespace for the same code. Perl 5.000 introduced the `my` function, which would declare a variable as lexically scoped. This solved the practical issues, but it left the problem of error-checking: a typo in a variable name would still create an implicit global with no warning. The solution was the opt-in `use strict;` declaration, which disabled the implicit-global behavior and made unrecognized variable names a compile-time error. Code could be fixed and then opt into the stricter semantics on a per-file (or even per-block!) basis, and nowadays most Perl devs will jump on you like a pack of hyenas if your code doesn't start with `use strict;` or some equivalent. Over time other features with too-sharp edges have been culled, still supported by the interpreter (Perl is more or less compatible going back decades) but made illegal in strict mode. JavaScript's weird "use strict" opt-in is a spiritual port of Perl's approach, stuffed into a string literal to fit into the existing syntax. One of its effects is even the same: assigning to an unrecognized name is now illegal, rather than creating an implicit global. I'm not aware of anything so fundamental being changed in such a heavy-handed way in PHP. From the outside looking in, I'm not even sure the PHP community has a strong consensus on what PHP-specific features to avoid. I'd be happy to learn that I'm wrong on either count.
- Killswitch 13y agoNow days the only valuable thing a naysayer can say anymore regarding PHP is the inconsistent naming and needle/haystack placement, which really makes no difference other than to be a slight annoying having to go to php.net/function_name and just make sure it's right.
- reustle 13y ago> which really makes no difference other than to be a slight annoying having to go to php.net/function_name and just make sure it's right. I can't tell if this is a joke or not
- Killswitch 13y agoOh no, I forgot the variable placement in a function, this language sucks! ಠ_ಠ
- deleted 13y ago[deleted]
- egeozcan 13y agoWhy would you keep looking at php.net when there are better, modern, easier to write alternatives? Cheap hosting? Come on, we're living in the days of 5$ VPSs.
- Killswitch 13y agoOf course, I sometimes forget if a function is function_name or functionname so I may as well just give up and just spend all my time learning a new language, all because I can get a VPS for $5... Sounds logical. Let me tell my boss he's gonna pay me to learn a new language because I couldn't remember a function name and tell all my clients they're gonna pay me to rebuild all their stuff in another language for the exact same reason!
- egeozcan 13y ago
- otikik 13y agoThe only feature I miss in PHP is un-gotcha-ness. Does it have that yet?
- camus 13y agoPhp still sucks, but the community is trying to build tools around it to make it better. But it doesnt make the language itself good. To make it good the first things to do would be to remove 90% of its silly "features".
- smsm42 13y agoYou mean, for you to like PHP it must cease to be PHP, die and be reborn as your favorite whatever. Sorry, not gonna happen. I guess for you it will suck forever.
- klibertp 13y ago> be reborn as your favorite whatever No. It's design should follow a few rules of good language design, which my whatever incidentally does follow too. It may look completely different from my whatever, or to be more precise from any of five or so whatevers I use on a daily basis. One of the rules I have in mind is having small, consistent core of powerful features, which then are used pervasively through the code, instead of having many different one-off special cases. For example AFAIK there is a 'list' keyword in PHP, which makes it possible to assign many variables at once. Why is it a special keyword instead of an instance of built-in DESTRUCTURING-BIND/pattern matching? Or another one: why is there a difference between arrays and objects implementing iterator protocol? Why a few different ways of handling errors instead of one facility? As you can see I don't tell you how the above problems should be fixed - I'm not trying to make PHP into my whatever. I'm expecting PHP to come with it's own answers to known problems in language design. This may be a bit too much of an expectation, seeing as PHP users won't even accept that there are problems in the language desing...
- krapp 13y agoseeing as PHP users won't even accept that there are problems in the language design PHP users can and do accept that there are problems with the language design (because of course they're the ones who have to deal with it), they just choose to work with the language despite these problems.
- 13y ago
- jonahx 13y agoTo give a serious answer to this: While you are right that php bashing isn't always rooted in informed objectivity, the point you're making is missing something deeper. It's sort of like when that person with a crush on you who you just don't like but who insists that if you really got to know them everything would be different. It's just not true. Even if could prove a 1 to 1 correspondence between features of ruby and php, php would still be... ugly. It would still lack grace. The feeling of looking at a page of php code just wouldn't be as pleasing. I believe it is this raw, irrational difference, this visceral reaction to the physicality of the code, and not a misunderstanding of features (even if they are misunderstood) that accounts for the most of the hate you allude to.
- smsm42 13y agoI personally think if you have raw, irrational, visceral reaction to programming languages, there's some priorities problem here. Those are tools. You're supposed to use them, not fall in deep emotional love (or hate) with them, that's what you do with people, not tools. I know this opinion may be unpopular and I know people do fall in love with tools (and use people) but I think they're doing it all wrong.
- eevee 13y agoTools should be designed to fit with humans; the goal is to minimize how much humans have to contort themselves to fit their tools. There'll always be some degree of learning and adjusting. But a mallet is still an improvement over a rock, because it's designed to fit in a human hand. I doubt anyone scoffed at the mallet and blogged that rocks have 80% market share so why can't we just get over it already.
- smsm42 13y agoThat's fine. People have different needs and preferences. Some drive Honda Accord, some drive BMW convertible and some drive GMC truck. It's just looks a little silly when Accord driver comes out and starts pronouncing that trucks are absolutely useless and he has deep visceral hate with anything that ugly stupid space at the back that nobody ever needs and millions of people that buy trucks are actually idiots just incapable of driving a clearly superior Accord.
- adamors 13y agoPHP 5.5 may be great but a lot of people in the real world still don't use namespaces and other things introduced in 5.3. That is why people are always calling out PHP because most of the language and most of its developers appear to be in suspended animation. Developers who use modern tools like Composer, Behat, frameworks other than Codeigniter etc. just aren't that many unfortunately. They're definitely not the majority, like they are over in the Ruby/Python camp.
- stephenr 13y agoRight, PHP is used by lots of developers and some of them make bad decisions or have limited experience.. Nothing at all like the first group of geniuses who decided Rails should store session DATA in a COOKIE BY DEFAULT, or the second, larger group of geniuses that routinely upload the secret token used to encrypt/decrypt said cookie, to public repos on Github/etc.
- Killswitch 13y agoFord sucks because with the improvements and better safety requirements to the car industry people are still driving older cars!
- eevee 13y agoDespite your sarcasm, that is a significant part of actually solving a problem: getting the solution into people's hands. Would you be very impressed with all the improvements if Ford's new line of 100% safe cars all cost millions of dollars?
- Killswitch 13y agoSo it's Ford's fault that people aren't buying new cars? Weird.
- deleted 13y ago[deleted]
- throwaway420 13y agoI think it's important to remember that each programming language is good at different things. You wouldn't ordinarily try and build your blog with C++ just as you wouldn't ordinarily try and create a new operating system in JavaScript. I think PHP is certainly capable of building larger systems and in recent years things like Composer and frameworks like Laravel are putting a lot of the PHP ecosystem on par with what's available for most other languages. But I view PHP's sweet spot as small web sites. If you're a small business that needs to add a form or two, some simple DB access, send a couple emails (a few dozen to a few hundred lines of code) PHP is your ideal choice to get something up quickly, get it up on virtually any web host out there easily, and get back to focusing on your business. PHP's lack of elegance doesn't matter all that much when you're talking about a small project. I think that Ruby/Python/etc are much more elegant when you get to the point that you're building larger web apps, but PHP is a very practical choice for lots of simple projects.