back to article Marmite of scripting languages PHP emits version 8.0, complete with named arguments and other goodies

Version 8.0 of the PHP scripting language is scheduled for release on 26 November, which coincides with the US Thanksgiving holiday. PHP turned 25 earlier this year and its latest iteration brings a variety of improvements to those who enjoy the language, which certainly isn't everyone. Type "is PHP" into Google Search box, …

  1. Anonymous Coward
    Anonymous Coward

    You know the script

    (pardon the pun)

    Angry comment shitfest coming in 3, 2, 1…

    1. Anonymous Coward
      Anonymous Coward

      Easy to learn

      In my opinion, one of the reasons computer languages run in fads is that if they are easy to learn, then they both get picked up by hobbyists/existing-programmers as well as introductory computer programming classes. The majority of folks who's programming education is limited (the vast majority of programmers) is limited because they are Scientists & Engineers whose use of programming originally is "to get the job done" for their own fields.That, and the fact that a lot of those folks over time end up writing software for a living, leads to the problems mentioned in this article where over time the code base get polluted with a lot of bad code, and "real programmers" start denigrating the language.

      And then someone invents the next flavor of the month language and the rush of lemmings starts anew towards the new blank slate.

      1. ICL1900-G3 Bronze badge

        Re: Easy to learn

        Hey...that's me! I started off as a research assistant and ended up as a systems programmer.

    2. bombastic bob Silver badge
      Happy

      Re: You know the script

      no angry comments here, as long as reasonable backward compatibility is maintained.

      And from my experience, PHP is pretty good with that.

  2. Anonymous Coward
    Anonymous Coward

    Google

    > Type "is PHP" into Google Search box, in Incognito mode, and the first two auto-complete suggestions you'll see are "is PHP still used" and "is PHP dead."

    To be fair, Google results for some reason seem to be biased towards constant negativity, no matter what your search term is (permanent private browsing here).

    1. Blackjack Silver badge

      Re: Google

      Some of the most used forums run on PHP.

    2. Steve Davies 3 Silver badge

      Re: Google bias

      a case of NIH perhaps?

      After all, Google is the internet to millions of people just like IE was a couple of decades ago.

  3. Anonymous Coward
    Anonymous Coward

    Entanglement

    "Some of the very large PHP projects have not always had the best coding practices and then those projects have been kind of trapped in a stage where they can't really work their way out of that problem, because they have a huge community and a huge amount of inertia behind the existing code base."

    Gosh, whatever popular blogging platform for pressing words onto the screen could you possibly be referring to...?

  4. Dave559 Bronze badge

    then they fall into the pit of success

    Hehe, "pit of success", that's a great phrase. I must remember to find excuses to use that…

  5. Anonymous Coward
    Anonymous Coward

    > Story added that he believes PHP has developed a bad reputation because, being easy to learn, it gets picked up by a lot of novice developers early in their careers. "So you get people who maybe don't have formal training or maybe don't know all the best practices and then they fall into the pit of success where PHP just does what they need to do," he said.

    To be fair, the same could be said of many a language, including for instance Python which I'm not a big fan of, but it doesn't have the same reputation. One thing that did set PHP apart back in the day, though, is that it wasn't originally "designed" as such. It was more of a quick hack by a guy to make his life easier when writing CGI scripts, so there were some pretty big holes in the early implementations that were trivial to exploit (like much CGI at the time). I guess we were all still in the age of innocence back then.

    It did me great service in the first decade of this century, but around 2012, when time came to set out the requirements for a new project, I just couldn't see myself inflicting PHP upon the team and I. My feeling was that it had become rather unwieldy. Not claiming to be right, just sharing why I moved away from it. Your experience may be different and if you're happy with it, so much the better.

    1. Ian 55

      It's also appallingly inconsistent about what a library function that does something is named.

      And it's from the people who thought testing if an integer variable is bigger than maxint was a good idea in a test with security implications.

      1. Dinanziame Silver badge
        Boffin

        Because reasons

        It's also appallingly inconsistent about what a library function that does something is named.

        That is because the library function names were originally tweaked to have different name lengths, because that is how they were bucketed. This is official, as declared by the creator of the language.

    2. Dave559 Bronze badge

      "It did me great service in the first decade of this century, but around 2012, when time came to set out the requirements for a new project, I just couldn't see myself inflicting PHP upon the team and I."

      Just out of curiosity, what language did you choose instead?

      1. Disgusted Of Tunbridge Wells

        Being 2012 I'm guessing Ruby on Rails. Which I'm betting he's regretting.

      2. Anonymous Coward
        Anonymous Coward

        > Just out of curiosity, what language did you choose instead?

        First of all, it's not a matter of language. Language is not that important, except in financial terms (developer pool) and to the extent that they are usually tied to particular ways of doing things.

        What happened was that around that time by accident I ended up doing a stint at a startup. It was a radically different way of doing things and I learned a lot from it. I had never worked on a system with millions of daily users before. You very quickly realise that your corporate/academic/purist way of doing things is, to put it frankly, crap.

        It turns out that those high volume sites tend to be super simple behind the scenes. It makes sense if you think about it, as every CPU cycle counts when you're dealing with high traffic.

        So I took a page from their book. Ok, more like a few chapters.

        The other thing that has changed, always within web-y sort of stuff, is that the frontend stack (HTML, CSS, JS, SVG, canvas, WebGL, …) has evolved a lot in the last ten years and is now quite complete and efficient so you can offload a lot of stuff to the client and it can, in turn, take advantage of the various APIs with are basically efficient abstractions of more or less commonly used operations.

        So, a lot of backend stuff nowadays is static. Nothing more than text (HTML, CSS, JS, JSON) files, perhaps supplemented by an API (or a collection thereof). This has a series of advantages, e.g., in terms of separation of concerns (presentation vs data), modularity, reusability, overall flexibility, and, not least, economy.

        So, if your presentation layer is static HTML + CSS and your data layer is either also static (e.g., JSON) or abstracted into an API, it doesn't really matter what you use to generate either the presentation layer or the data.

        In practice, I take an opportunist approach and start by reusing whatever is available and optimising / refining later if warranted. A recent project consists of hand-written HTML + CSS (Stylus) and a mixture of Python for input data processing, PostgreSQL for a database, and a Node.js API, with Bash for instrumentation. Another project is static HTML + CSS + JS files generated with Hexo.js and JSON data generated with Bash + Awk. Yet another was static HTML with a Node.js backend with custom C plugins to do the data processing.

        An important rule of thumb that I learned is, it shouldn't take more than half an hour to explain your architecture to a new employee / contractor. If you can't, your architecture is too complex (and almost certainly, unnecessarily so) and you better simplify it before you go any farther.

        1. Anonymous Coward
          Anonymous Coward

          "so you can offload a lot of stuff to the client"

          "so you can offload a lot of stuff to the client and […] So, a lot of backend stuff nowadays is static."

          Ugh, so, reading between the lines, you're sadly one of those people that we all grumble about because teh modernz web is a ghastly mess of bloated client-side JavaScript, rather than most of the heavy lifting (and validation) being done on the server where it belongs? :-(

          (JavaScript might be a useful thing, but it would still be nice if as much of the web as reasonably possible could still work without absolutely requiring it, not to mention that anything on the client is something that someone malicious with time on their hands can manipulate to feed malicious data back to the server…)

          1. Anonymous Coward
            Anonymous Coward

            Re: "so you can offload a lot of stuff to the client"

            There is using and there is abusing.

            Yes, there will be people writing crap code that happens to use JS. The problem is the crap code, not the tools (a bad craftsman, etc.) Would you trust the same person to write secure and reliable backend code, for instance?

            If your site is essentially a marketing brochure, there is hardly any point in using JS, let alone requiring it. That's why I use NoScript.

            OTOH if you are providing an application or an application frontend, there is hardly any justification to not use JS. Aside from providing a much more fluid user experience, it saves the extra bandwidth and time wasted on unnecessary data + content/data round trips, lets you offload some or all processing to the client, and preserve the user's privacy and confidentiality by either not needing to send data across the network at all (if the processing can be done locally, e.g., photo editing, barcode generation, …), or by using end to end encryption (where data is encrypted on the client before transmission, so the server never has access to the payload contents).

            PS: My first web project was a CGI program in C, before PHP and all the rest even existed and around the time when the default Apache configuration gave you access to the whole server via /cgi-bin (because people were trusting like that back then ☺).

            1. Anonymous Coward
              Anonymous Coward

              Re: "so you can offload a lot of stuff to the client"

              > around the time when the default Apache configuration gave you access to the whole server via /cgi-bin

              Ah, the phf hole, that was it.

    3. Anonymous Coward
      Anonymous Coward

      "To be fair, the same could be said of many a language, including for instance Python which I'm not a big fan of, but it doesn't have the same reputation. One thing that did set PHP apart back in the day, though, is that it wasn't originally "designed" as such. It was more of a quick hack by a guy to make his life easier when writing CGI scripts, so there were some pretty big holes in the early implementations that were trivial to exploit (like much CGI at the time). I guess we were all still in the age of innocence back then."

      This is true of anything. Even video games. When they made TF2 free to play, I was still playing with some usual suspects, and then an ocean of newbies arrived, being comically clumsy/ignorant.

      I even remember as a medic, killing a spy in hand to hand combat.

      Back then, it was *never* suppose to happen.

      1. FlamingDeath Silver badge

        Team Fortress 2 - Babysitter edition

    4. overunder Silver badge

      "...don't have formal training..."

      Formal training in PHP consists of re-re-referencing the API so that the next new thing doesn't break the old thing... that's it, formal training done! BTW, the training exercises for The International Obfuscated C Code Contest are now being hosted at https://www.php.net/manual/

      BTW, if you look at the highlights for PHP v8, you might see some mimicking of another "V8" (node.js)

    5. Robert Grant Silver badge

      The problem with PHP is "best practice" is stuff to work around the craziness of the language, rather than ways to make your code as well-structured and high-performance as possible.

      Python's mutable default arguments are so well known because they're a rare case of the language doing something unexpected, and so require a "best practice" rule. PHP is full of such cases.

  6. werdsmith Silver badge

    I expect there is work for code maintenance for PHP, but I assumed nobody in 2021 is going to start a new project with it. I recently found a number of books about it in my garage. They have gone for recycling,

    1. theOtherJT

      Depends what you're trying to do I suppose. I'd still rather write PHP than python if I'm doing webapp type things, but I'm sure everyone has their go-to language for a certain task.

    2. Anonymous Coward Silver badge
      Flame

      If you had physical books for the PHP documentation, you were doing it wrong. The online documentation is always more complete and up-to-date.

      1. Anonymous Coward
        Anonymous Coward

        re: book

        You forgot to add the caveat 'for a given value of up-to-date'

        1. SF

          Re: re: book

          lolz

      2. werdsmith Silver badge

        Depends if you like a particular style of instruction. These were training books, not reference manuals and they were from PHP's salad days about 20 years ago.

    3. doublelayer Silver badge

      "I expect there is work for code maintenance for PHP, but I assumed nobody in 2021 is going to start a new project with it."

      It really depends on the scale. For example, I sometimes work on one-time projects for charities, which usually take the form of some basic web forms glued together. I often end up using PHP for the backend because it doesn't require additional effort to get it running. Nearly every server already supports PHP scripts in the backend. Had I chosen a framework that requires other things, I'd have had to ensure the server they're planning to use supports it, that it's been installed and configured correctly, etc. Since a lot of these nontechnical and small places use a shared hosting plan, it's much easier to say "put these files on your server via FTP in this directory, or give me the credentials and I'll do it for you" rather than "We're using a framework called Flask, so I'll need access to your server to verify that it supports it. Also, we will need your server software to redirect some URLs to the Flask engine so please remember that I did that in case the next person to volunteer for your web tasks doesn't figure that out". Also, while someone might not be starting a new large project from scratch given the CPU limitations of PHP, there are plenty of existing codebases written in it. When people want to add features to those, they'll probably end up writing their new features in PHP too.

    4. bombastic bob Silver badge
      Linux

      in the last 2 years I have designed no fewer than 3 major projects that have a PHP back-end for a web interface, typically for a touch screen on an embedded system (not to mention the supporting web server, a 4th project in a way). I specifically chose PHP as the best solution for rapid development to customer deployment, for its maintainability, and for overall performance.

      PHP is most certainly _NOT_ dead, nor has it been relegated to "maintenance only".

  7. Thought About IT

    I found the Laravel framework good for recoding my web site in PHP.

  8. tin 2

    PHP... misconfigure your webserver (or have it misconfigured for you) and there's your undercrackers on display in public. That's probably a massive oversimplification but is the reason I stayed away.

    1. DJV Silver badge

      ?

      If the webserver is configured to not pass the files to the relevant language processor then it doesn't matter which language it is, whether it's PHP, Perl, Python, ASP or any of them. Your total lack of understanding is the real eye-opener here.

      1. ttlanhil

        Re: ?

        You're not wrong, but I suspect PHP is more likely to suffer that fate.

        If you're running, say, a Flask of python, or a NodeJS instance, or a perl app on Plack, etc, then the webserver is just a layer adding HTTPS (and a few other bits).

        If it's misconfigured, you get an error page - no source code leakage.

        For code running in a processor in the web server's space, if you're on apache you can usually assume PHP will work, while for mod_perl (for example) you're more likely to need to install it yourself.

        That assumption means you may forget to check.

        PHP being an easy option for beginners to quickly hack something together means it's more likely to see beginner mistakes

        1. werdsmith Silver badge

          Re: ?

          Yes, the gunicorn arrangement is where I thought we had moved on to.

        2. Graham Dawson Silver badge

          Re: ?

          mod_perl would be fairly unusual for a new project today. You're more likely to find PHP running at the far end of a fastcgi pipe, putting it on the same footing as other application languages.

  9. cookieMonster

    It’s not bad

    I’ve used it for some small projects or internal tools, to prove a concept was workable or valid. But if I decided to develop the idea I went with RoR, mainly because I was lazy and rails provided all the scaffolding I needed to get the job done.

    1. Anonymous Coward
      Anonymous Coward

      Re: It’s not bad

      "mainly because I was lazy and rails provided all the scaffolding I needed to get the job done."

      I hate to nitpick and correct typos, but you misspelled "I saw that rails had much of the structure I needed, meaning I could save the time, cost, and frustration of developing a bespoke solution".

  10. llaryllama

    Unashamed PHP fan

    I come from a C background having moved on from hardware device drivers to embedded industrial systems and web backends. Always had a soft spot for PHP because there is so much carry over from C, it can be very powerful and quite nippy in the right hands. I have some fairly large projects written in PHP including an accounting application I wrote 15 years ago that's still going strong.

    1. batfastad

      Re: Unashamed PHP fan

      Same. It's great.

      I still have many web APIs going, modernised to PHP 7, and absolutely fly along with APC/OpCache.

    2. Tom 7 Silver badge

      Re: Unashamed PHP fan

      I've written a couple of online shops and customer support db apps and a db app document/security controller with it around the turn of the millennium. Not been near it since - I found I had to write a few functions to wrap it to prevent it doing PHP things but I found the ASP approach far easier to manage and maintain than Django or Flask even with bizarre PHP quirks. Its so much easier to interface the server with the client when most of the code is on the same file and screen.

      I may pop back and see if the new version solves a couple of problems that worried me about the language 15 years ago as I have a particular fondness for ASP that even VB didnt put me off.

  11. batfastad

    Keep it up!

    To be honest I still think you need a good reason to choose something other than PHP for server-side web and HTTP API stuff.

    Python, Ruby, Scala even Go, all have web frameworks. PHP and any of the many modern frameworks is still hard to beat.

    People download Drupal/Joomla/Wordpress, install a bunch of plugins for whatever business requirements, then blame PHP for the fact they can't get more than a couple of hundred rps... ignoring the fact that their CMS is probably making 1000+ database queries to render each page.

    Or the other side are the PHP apps developed 8+ years ago by an opinionated dev who thought they were better than using a modern framework, completely sacrificing the project's modularity and maintainability in the process. Yes Laravel might not work exactly the way you want but seriously, for the sake of future developers/employees working on your project, just use a community-developed framework. Any framework will be better than your hand-crafted gubbins.

    Oh also a shout out to the PHP docs. The most accessible language documentation I've ever used. Individual pages per function/class with version history and curated examples. Compare that to the nightmare single page wall-of-text with different URLs for each language versions that you often see.

    1. batfastad

      Re: Keep it up!

      And I wonder how many projects driven by tech lead bros with an anti-PHP agenda are now on their 3rd rewrite in 10 years due to old shiny no longer being supported, maintainable or recruitable.

      1. Dave_uk

        Re: Keep it up!

        classis comment! Love it: "... old shiny no longer being supported, maintainable or recruitable."

        And "recruitable" really should be a real word.

    2. Anonymous Coward
      Anonymous Coward

      Re: Keep it up!

      > Yes Laravel might not work exactly the way you want but seriously, for the sake of future developers/employees working on your project, just use a community-developed framework. Any framework will be better than your hand-crafted gubbins.

      Results may vary.

      The theory of frameworks is a good one: you get to have a set of standardised, community-vetted libraries to do all the hard work - and they're designed to work within a "best practice" approach. And they help to get rid of (or at least minimise) the underlying weaknesses and problems with the underlying language and architecture.

      After all, as one teacher was fond of saying, anything can be fixed with another layer of abstraction.

      But. That extra layer of abstraction carries it's own costs.

      First is the fact that you now have to learn how to use the framework. And while it may not be true for all frameworks. Laravel (and Symfony, from which it inherited a lot of features) have a lot of complex implicit features which aren't particularly well documented; if you're stuck on something, the odds are far better that you'll find the answer on stack overflow rather than on the official Laravel website.

      E.g. Laravel has a templating system based around "views". And you can set up "composers" which will be automatically triggered if a given view is loaded, and which can then be used to prepopulate the template with useful data.

      So you don't have to worry about manually setting things up in the controller, nor do you have to put any complex logic in the view.

      But at the same time, the fact that it's implicitly triggered means that if you're not the person who developed that code (and/or it's been long enough for time and alcohol to kill off the memories), then you'll have to hunt around to find where the composer definition is, and what it actually sets.

      Similarly, you can specify that a HTTP controller method takes a specific "request" class; this class will inherit from the base "request" class, but will then contain custom logic to validate the data sent to the server (and/or perform other secondary tasks, like pre-loading data).

      Which, again is great. But if the validation fails, the request will be silently rejected without any exceptions or log messages - the action won't even reach your controller method!

      One of the developers where I work - who's spent years working with Laravel - lost the best part of a day trying to figure out why his new code was failing, until eventually realising that some validation logic was unexpectedly being triggered deep within the many layers of the request object his method was trying to use.

      And so on. All this heavily abstracted and complex logic is great if you have the time to learn it all, and make frequent enough use of it to not forget it. Though even then, you have to hope that there hasn't been some sort of paradigm shift between framework versions which invalidates the previous set of abstractions...

      The second aspect is performance. A lot of stuff in Laravel - especially the Eloquent database system - is done via "magic" methods, where you request a class attribute or method which doesn't exist; Laravel then uses PHP's __magic() methods to figure out what it was you actually wanted and does lots of stuff behind the scenes to do the actual work.

      As a result, it's not uncommon to see stack traces which are sixty or more layers deep, as the action you requested is fed into __call(), which then goes off and creates a new object, which then triggers it's own magic method, which then goes off and creates a new object, which then...

      And then there's Eloquent. Which at heart, is a way to abstract your database logic into a set of classes. Again, this is great - you get a single, standard set of classes; not only can you have methods on these to perform actions, but you can define relationships between them.

      But this approach really doesn't scale well, especially if you're working with complex legacy database schemas. Want to pull data for a couple of one "entity", with data coming from half a dozen tables? Ok. A few hundred? Fine. Creeping up into the thousands? Time to make a cup of tea and come back when it's done.

      (never mind the amount of twisting you have to do if you're wanting to do any complex joins or filtering, or the state of the queries which are generated by Laravel. Or how nasty the Eloquent calls become when you start throwing together all the relationship mappings, especially if you're using closures and the like...)

      To be fair, some of this is specific to Laravel's particular implementation, and there is stuff you can do (e.g. eager loading) to improve things like database query performance. But sometimes, it's a lot simpler, quicker and more maintainable to do things the old fashioned way.

      Admittedly, I've no desire to return to the days of hand-crafting everything, since that carries it's own set of risks and issues. But I do think that while frameworks are great - and definite development time savers - when they work, they're also a nightmare at times!

  12. Sampler

    Old documentation

    I think one of the biggest problems for PHP is outdated documentation. As someone who's not a coder but needed to get something to work I found an example in php that did the trick, this happened several times and so when coming to build something bigger it started becoming my go to, especially as these are internal things never to see the light of a public network it was fine.

    Down the line I need something public facing and oh god how many security holes are in these examples I'm reading through, like, fixed decades ago but still showing the old way in recently posted tutorials.

    My film club needed a way to handle rsvp's since covid struck and we had to limit to 14 people, nothing I could find (in our budget of three beans) could handle rsvps with a cap and a waitlist so I was like, hey, that sounds like something I could probably bash out in an evening with a bit of copying from stackoverflow for the hard bits. Go out and look for "php user login system" and see how many examples have any SQL injection protection. Like, pdo with binded variables will leave a SQL injection dead in the water (as far as I've read) but barely any example uses them and only a few having a passing mention that the end user might want to look up about security - the end user who needs to google how to do a login page, they're not going to grasp the wider issue at hand here.

    I'm sure I've made several other beginner errors (hence not linking it here as an example), especially with post or global variables (I've worked around get variables at least) and although I think I sanitise everything, I don't really know, and I guess I'm not the only person in this boat, just might be old enough to at least wonder about security rather than just be happy I got shit up and running.

    But, as I have a day job (that seems to like to be an evening job fat too often), really digging in to the security isn't something I have time to do and, a little, the inclination, given the wording of a lot of the documentation I do find isn't very accessible to someone starting out, which is kinda counterproductive, given we're the ones who're going to make the biggest mistakes? Trying to teach someone security once they've got their bad habits well and truly ingrained seems a poor choice.

    1. batfastad

      Re: Old documentation

      This is true and very typical of PHP pre-2008/2010 era. People scratching around forums, finding a function someone wrote in 2004 and re-using it. It's all a nightmare.

      In the last 10 years or so there has been such a good choice of PHP frameworks that you shouldn't ever need be involved in the security/plumbing at all. Codeigniter and cakephp were probably the first popular ones, allowing any hideous complexities to be abstracted away behind single functions/classes.

      Googled-copied-pasted snippets of code of *any* language with permission to read/write to file systems and databases while being exposed to the internet will always end in tears. It was the same with Perl in cgi-bin directories all over the web in the late 90s.

    2. Dave559 Bronze badge

      Re: Old documentation

      "I think one of the biggest problems for PHP is outdated documentation."

      That's not the official documentation that is out of date. The PHP group have always been very good at keeping the official documentation up to date, and at putting up big red warnings about the deprecation of, say, the mysql functions well in advance (as well as telling you why you should really be using newer, better, more secure database functions instead), etc.

      It is, as other posters have said, other people's own tutorials, possibly long abandoned, but with good search ranking, possibly cargo-cult copied from other earlier also outdated tutorials, and even books still being published that glibly spewed about the mysql functions after these were known not to be best practice, that were the problem. Thankfully the evolution from PHP 5.x to PHP 7 removed those, as well as various other crufty junk.

      Heck, if you search the web for "formmail" (or "mail form"), that old insecure Perl script from "Matt's Script Archive" even now still comes up fairly highly in the search results!

      1. FlamingDeath Silver badge

        Re: Old documentation

        Definitely, I sometimes limit search results of coding examples by time because of this, so much outdated stuff with higher page rank. PHP.net is an excellent reference point

  13. Robert Grant Silver badge

    They keep blaming best practice

    Best practice is what you need if your tool is terrible. Oblig: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

    Second oblig: https://devhumor.com/media/the-year-is-2038-stackoverflow-has-become-sentient

    1. SecretSonOfHG

      Re: They keep blaming best practice

      I disagree: any tool, no matter how good it is, can be misused. Best practices are there to prevent that

      1. captain veg

        Re: They keep blaming best practice

        Who is to say what is best? What does "best" even mean, without knowing the context?

        Looks like groupthink to me.

        -A.

        1. zuckzuckgo Bronze badge

          Re: They keep blaming best practice

          > What does "best" even mean

          That it is at least not worst? That it avoids some common pitfalls that the less experience may not recognize. Everybody at some point is a beginner.

    2. PassiveSmoking

      Re: They keep blaming best practice

      Yes, clearly an opinion piece written over 8 years ago by a furry with a section on their website called "weird porn" is an opinion you can trust!

      Any remotely complex project written in any programming language requires you to adhere to best practice unless you want an unmaintainable tangle of spaghetti code.

      1. Anonymous Coward
        Anonymous Coward

        Re: They keep blaming best practice

        Eeek, I had never realised that that "PHP: a fractal of bad design" website had some other more, uhh, esoteric content on it!

        But, on the other hand, their article about CSS is quite interesting reading (in real life, I got to roughly the stage they describe of trying to make multi-columnar pages with CSS floats (which was a little fiddly itself) before CSS then got way more complicated and, it not being the main part of my job, I sadly could no longer keep up with and properly absorb all teh shiney new stuf after that…).

        Just because they have some, umm, unusual hobbies doesn't mean that some of the stuff they write might not be worth reading…

      2. Michael Wojcik Silver badge

        Re: They keep blaming best practice

        Yes, clearly an opinion piece written over 8 years ago by a furry with a section on their website called "weird porn" is an opinion you can trust!

        Yes, clearly a critique that begins with an utterly irrelevant ad hominem is worth paying attention to.

    3. a_yank_lurker Silver badge

      Re: They keep blaming best practice

      Best practices for many programming languages are very similar. There are differences when addressing each language's quirks and community preferences for naming conventions, etc. The main idea of best practice is produce readable and maintainable code efficiently that someone familiar with language can understand without getting a migraine.

  14. Disgusted Of Tunbridge Wells

    People complain that PHP is badly written, but that's just because it's easy to pick up so amateurs use it, but can you imagine how bad the state of things would be if all websites had to be written in C?

    Segfault would enter the general lexicon, just as 404 has.

    1. Smartypantz

      "functions" FTW

      The cloud providers are hyping "functions" as a completely server-less tech (just more power, money and control grabbing off course). This is, in actuality, CGI reinvented.. HAR!

      Thinking about just writing CGI in C. All the higher level "web languages" are crap, bloating, dying or evil (or all 4 ;-) ).

    2. Michael Wojcik Silver badge

      No, it's because PHP is a fucking nightmare of astoundingly poor design decisions and, probably more frequently, design accidents because no one gave them sufficient thought to merit the label "decision".

      The type system is a mess, with inconsistent ad hoc conversions and operators, and crap mechanisms for type safety in function calls. The interactions between static configuration, runtime configuration, and syntax such as the @-prefix for error-handling suppression are unpredictable. The library is a vast wasteland of incoherent rubbish. Features which might improve the situation a bit, such as exceptions, are awkwardly bolted on, don't interact properly with other features, and weren't refactored into the existing library and core language. The OO stuff, while it helps (when used sensibly), is also a bizarre mess; for example, instanceof is an operator1 and is_a is a function, and they do more or less the same thing, except is_a can trigger autoload and who knows what other horrible behavior lurks in there? And so on, and so on, and so on until the heat death of the universe.

      PHP invented mistakes no one had ever conceived of before. I find it hard to think of anything PHP does correctly.

      And, of course, traditionally PHP positively encouraged security holes, thanks to adopting string concatenation and interpolation as its default mechanisms for doing pretty much anything, including database operations.

      1Side note: If I go to php.net and search for "instanceof", it says there are no hits. But it's mentioned in the documentation for is_a, for example. That's because the search box apparently only searches the functions, and not other language features; and it only searches the titles. Why? Because the PHP philosophy is "do it wrong".

      Of course you can browse the documentation for it. The Operators page helpfully says this: "instanceof = instanceof". You don't need to know anything more! Do not question it!

  15. chipbsas

    PHP cost 0

    If you compare with any tech PHP cost CERO.

    Cero in compile the code before "production" How much money you save stuff in resources?

    Cero in time to dev something. Do you need to install jdk, maven, npm, packages, 300 hundreds of line of code and config to say "Hello World".

    Cero time in changes, hot changes in production.

    Cero time in learn and spent to get good developers

    Cero resources to mantain his performance

    Cero time to create a good architecture.

    All you need is love.... and be a good Engineer not be a good Marketer tender

    1. zuckzuckgo Bronze badge

      Re: PHP cost 0

      Konfusing

    2. doublelayer Silver badge

      Re: PHP cost 0

      I assume this is an attempt at a joke?

      "Cero in compile the code before "production" How much money you save stuff in resources?": Because compiling any number of smallish projects uses so much precious CPU time? This isn't the 1970s. I can type "make" and wait five seconds.

      "Cero in time to dev something. Do you need to install jdk, maven, npm, packages, 300 hundreds of line of code and config to say "Hello World".": I have to install PHP and, if I'm using PHP in the most typical way, a webserver configured to use it. Not much different.

      "Cero time in changes, hot changes in production.": You're fired. Really. You don't install changes into production. You run it through tests and review first, then it's elevated to production.

      "Cero time in learn and spent to get good developers": Ah. Free PHP devs? Sure thing. Send me ten of those; I'll find something for them to do if the work is free.

      "Cero resources to mantain his performance": I don't know what this even means.

      "Cero time to create a good architecture.": Trust me, whatever you're writing in, you need time to create a good architecture. It's one of the most important things to spend time on.

  16. Fruit and Nutcase Silver badge
    Joke

    "One of the key things that people love about Python is being able to use named parameters and not have to worry about the position of the parameters as much and not have to wrap them in another structure like an array."

    One of the key things that people have strong opinions about Python is the delimiting by whitespace/indentation. Were they at all tempted to lift that?

    Note: subject line - whitespace

  17. FlamingDeath Silver badge

    PHP

    Partial Hospitalisation Program

    Jokes aside, I actually really like PHP

    I can think of some worse, Javascript

  18. 759b954e-617b-408b-a2b1-f5a42c3688d4

    It's all relative

    If you look at the hot mess that is JavaScript, PHP is a veritable paragon of virtue.

    1. werdsmith Silver badge

      Re: It's all relative

      That’s like comparing Boris and Trump. You can choose which way round.

      1. a_yank_lurker Silver badge

        Re: It's all relative

        Choosing between a couple of obnoxious New Yorkers is not much of a choice (Boris was born in NYC).

  19. carl0s
    1. carl0s

      I'll reply to myself then.

      Django by itself should have been enough. I really shouldn't have needed to say more.

      I suggest anybody considering PHP should look instead at Python and in turn at Django.

  20. lunacybooth

    Have to say that headline is a thing of beauty.

  21. J27 Silver badge

    Marmite? Wouldn't that be Python? A language that's equally loved and hated. PHP is more like surstroemming, old and smelly and very unpopular but for some reason some people still like it.

  22. Steve Davies 3 Silver badge

    PHP runs the Internet (or nearly)

    Wordpress runs an awful lot of websites. Under the hood, Wordpress runs PHP code (v7.4 or later)

    That means PHP is not dead by a long way. Reports of its death are greatly exagerated.

  23. This post has been deleted by its author

  24. ZanzibarRastapopulous

    Easy?

    Just tried to use PHP for a small web project and it most certainly isn't easy. Open syntax doesn't make for decent error checking tools, a weird mix of functional and oo styles, odd function names in the core libraries a huge mish-mash of frameworks in the ecosystem (frameworks are fast becoming a pet hate), and poor debugging support.

    No, it's not easy, or good.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2021