5 ms·
> Seriously. The hate for PHP is strong, but I don't really see why. > Just use PHP 7! There are funny things related to implicit type conversion and some rule
by spdionis 8y ago
> Seriously. The hate for PHP is strong, but I don't really see why.
> Just use PHP 7! There are funny things related to implicit type conversion and some rules produce funny and unintuitive outcomes. These conversion can be very handy on the other sides.
> "PHP_INT_MIN < PHP_INT_MAX" and they are damn right that this is true!
Feeling the perception difference?
- Klathmon 8y agoI always felt the same about PHP. It gets a lot of shit because some of the oldest parts have some weird function names or parameter order, but outside of that it's a fantastic language, especially if you stick with php ~5.5 and newer. It's fast, it has a nice package system, and the pepole behind the language are making it better, faster, and more feature complete every day, with standards bodies which includes the biggest players in the space. IMO languages like Go could learn a thing or 2 from PHP about how to stop worrying about the "best possible choice" and just start giving the language the tools that developers can use to solve real problems.
- akatechis 8y agoThe difference is that JS has to be backwards compatible in order to not break 50% of the internet. With PHP, it is theoretically possible to make a major version upgrade that fixes most if not all the issues without worrying about breaking backwards, since upgrading is opt-in.
- Klathmon 8y agoUpgrading was opt-in with python as well, and look at where breaking changes got them... A decade in and there's still a massive rift in the python community over 2 vs 3. PHP is backwards compatible almost to a fault, but that doesn't mean you can't use new libraries or frameworks that hide those warts away from you, and that's a MUCH better choice in my opinion than making a significant percentage of the internet incompatible with the latest PHP so that your function arguments for a handful of old function calls can all look the same...
- anchpop 8y ago"massive rift" is a bit of an exaggeration. Most Python libraries have Python 3 versions and it's not at all uncommon to see libraries that don't have support for Python 2 (see Django)
- Klathmon 8y agoI don't think it is. Sure, it's not like they are 2 different languages, but it's something that all python developers will have to keep in mind when using libraries. Not to mention the headache of having both installed on many systems (what does `python` give me?), and there are still many things that don't have python3 versions still (node-gyp is the one that still bites me every day). It's not the end of the world, and it is getting better every day, but having to spend the better part of a decade dealing with multiple "main" versions of a language is not something that I want any other languages I use repeating. And if that means needing to lookup if the function is urlencode or url_encode, well i'm happy to pay the price.
- jrs95 8y agoI mean sure, PHP has a package manager and you can write software in it. But what compelling advantages does it have over it's competitors if you don't either have legacy code or are primarily a PHP developer?
- Klathmon 8y agoIt's been a few years since i worked with PHP daily, but off the top of my head: * the shared nothing architecture is extremely easy to reason about (the world begins with a request, and ends once it's out) * shared-nothing also means it scales stupidly simple. Need to handle more requests? spin up more servers, on an almost linear scale, until your DB can't keep up. * it's pretty damn fast all things consitered * the barrier to entry is a fraction as difficult as setting up a backend with java or go or python (although setting up a LAMP-ish stack on windows for development still kind of sucked when i last did it) * It's probably only second to javascript when it comes to just sheer number and breath of 3rd party packages * backwards-compatibility is a huge bonus. I can be fairly sure that code I write now is going to keep working with minimal changes for the next decade (for varying definitions of "minimal") * developers that are comfortable with it are cheap and readily available (although this is changing for the worse lately) * it's simple. For the most part you don't need to worry about concurrency, about async requests, parallelism, callbacks, etc... Scripts run from the top to the bottom, and they do that every request. Sure, this is a massive drawback as well if you need those features, but PHP's "make it work any way possible" kind of ethos means that there are ways around most of those limitations that work really well... once you stop vomiting over how hacky some of them are in theory. It's not the most pretty, it's not the fastest, it's not the safest, and it's not the most "pure", but it is a glorious mutt that just keeps on trucking along, and I'm not ashamed to say that I really enjoy the language and I would gladly start a new project in it today if the opportunity arose.
- x0 8y ago>it's pretty damn fast all things consitered This is my favourite part of PHP. It really is fast. There's no server running all the time like a node or python website, on each web request it has to start up again and rebuild its entire state.