Stories
Slash Boxes
Comments

SoylentNews is people

posted by azrael on Thursday July 31 2014, @10:31PM   Printer-friendly
from the pretty-happy-programmers dept.

The PHP language has been around for over 20 years and is clearly one of the most popular programming languages in the world. PHP is definitely the lingua-franca of the internet.

While there is extensive user-documentation, the PHP language has always been missing a language specification. That is not to say a specification hasn't been thought about or discussed. It is just that one has never really come to fruition.

And now, the entirety of the initial draft specification has been released to the world. It is hosted on a git repository at php.net and this repo will be mirrored to GitHub.

This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 0) by Anonymous Coward on Thursday July 31 2014, @10:36PM

    by Anonymous Coward on Thursday July 31 2014, @10:36PM (#76152)

    So they'll just codify all the stupidity into us back?

    This is only going to be useful if they break with all the dumb decisions of the past.

    • (Score: 3, Insightful) by Nerdfest on Thursday July 31 2014, @11:42PM

      by Nerdfest (80) on Thursday July 31 2014, @11:42PM (#76175)

      It's like the ISO 9000 certifications. You can have the stupidest processes in the world as long as you document and follow them. This would be a painful document to write.

  • (Score: 1, Funny) by Anonymous Coward on Thursday July 31 2014, @11:15PM

    by Anonymous Coward on Thursday July 31 2014, @11:15PM (#76164)

    PHP is definitely the lingua-franca of the internet.

    Are you fucking nuts?! The Internet works on C and Perl, or what do you think we're running here, an amusement park?

    Now, get off my lawn!

  • (Score: 4, Interesting) by cafebabe on Thursday July 31 2014, @11:20PM

    by cafebabe (894) on Thursday July 31 2014, @11:20PM (#76166) Journal

    I thought PHP was informally specified as a dialect of Perl with the following differences:-

    • Code lives inside magic tags and a magic invocation inhibits CGI headers being emitted.
    • A key/value hash is also accessible as even/odd element pairs of a growable array.
    • Arrays and hashes live in the same namespace as dynamically typed simple variables.
    • The simplified variable namespace allows the symbolspace to be simplified.
    • A laundry list long-named functions live in a flat namespace.
    • There is no /e regex.
    • Object orientation differs.

    Overall, it is a fast and usable language. Very good examples of PHP can be found, such as the wikimedia code. Unfortunately, PHP is dragged down by a culture of illiterate codemonkeys but this is not a fault of the language.

    --
    1702845791×2
    • (Score: 3, Interesting) by Nerdfest on Thursday July 31 2014, @11:45PM

      by Nerdfest (80) on Thursday July 31 2014, @11:45PM (#76178)

      but this is not a fault of the language.

      I don't really agree with that. Like Visual Basic and a few other languages, PHP encourages bad coding practices.

      • (Score: 3, Interesting) by cafebabe on Friday August 01 2014, @12:18AM

        by cafebabe (894) on Friday August 01 2014, @12:18AM (#76188) Journal

        Too often, I have seen CSS, JavaScript, HTML, PHP and SQL in one file. Partly, this occurs due to the problem domain for which PHP is optimized. Partly, this is due to the relative brevity of PHP. Theoretically, it is possible for CSS, JavaScript, HTML and SQL to appear in one C source file. However, C is less likely to be used in this manner.

        --
        1702845791×2
    • (Score: 1) by rufty on Friday August 01 2014, @01:32AM

      by rufty (381) on Friday August 01 2014, @01:32AM (#76198)

      PHP, a ho-hum kinda language with really, really good documentation.

      • (Score: 2) by Thexalon on Friday August 01 2014, @03:50PM

        by Thexalon (636) on Friday August 01 2014, @03:50PM (#76422)

        a ho-hum kinda language with really, really good documentation.

        No, it's not good documentation. It's not even passable documentation. The biggest problem with the documentation is that there is not infrequently completely undocumented behavior that will affect the running of your program. And don't get me started on the people offering their "wisdom" in the comment sections on php.net: Follow any of their advice at your peril.

        --
        The only thing that stops a bad guy with a compiler is a good guy with a compiler.
    • (Score: 2, Interesting) by GeminiDomino on Friday August 01 2014, @02:17AM

      by GeminiDomino (661) on Friday August 01 2014, @02:17AM (#76207)

      PHP may be "dragged down by a culture of illiterate codemonkeys", but that just makes it an (objectively) bad language dragged further down down by a culture of illiterate codemonkeys.

      You can't blame things like the ternary operator and mysql_escape_string_i_really_mean_it_this_time() on "illiterate codemonkeys", unless you're talking about the ones designing the language -- and a special DIAF goes out to the developer who facilitated, either through buggy code or a fundamental misunderstanding of what "exceptions" are, that PDO should through one when a MySQL "INSERT" statement succeeds without error.

      A bad language with a lot of inertia behind it is still a bad language, and after working with it day-in and day-out for seven years, I've gotten to see just about all of the ways it's a bad language.

      --
      "We've been attacked by the intelligent, educated segment of our culture"
      • (Score: 2, Funny) by GeminiDomino on Friday August 01 2014, @03:57AM

        by GeminiDomino (661) on Friday August 01 2014, @03:57AM (#76235)

        Ugh... s/should through/should throw/

        Need more coffee, less PHP.

        --
        "We've been attacked by the intelligent, educated segment of our culture"
      • (Score: 3, Interesting) by cafebabe on Friday August 01 2014, @11:38AM

        by cafebabe (894) on Friday August 01 2014, @11:38AM (#76328) Journal

        Regardless of the language used, Apache + MySQL has plenty of catches for the unwary. For example, Apache HTTPD 2.2 has a default connection limit of 256 [apache.org] while MySQL Server has a default connection limit of 151 [mysql.com]. Many people discover this the hard way.

        Actually, the old limits were 150 for HTTPD and 100 for MySQL. It seems that MySQL raised the limit to fix the situation (plus provide one connection to see what the blazes is going on). However, it seems that Apache broke it again.

        --
        1702845791×2
        • (Score: 1) by GeminiDomino on Friday August 01 2014, @12:30PM

          by GeminiDomino (661) on Friday August 01 2014, @12:30PM (#76343)

          If you're referring to the exception issue I mentioned, no, that's not it. PDO throws an "HY000" error 0 exception, even when apache isn't in the mix.

          --
          "We've been attacked by the intelligent, educated segment of our culture"
          • (Score: 2) by cafebabe on Friday August 01 2014, @01:40PM

            by cafebabe (894) on Friday August 01 2014, @01:40PM (#76370) Journal

            Unless you enable strict mode in MySQL Server config and/or command line and/or after initializing each connection, MySQL Server will let you insert any old junk. It may not be a sensible default but it is done for downward compatibility. Cisco has similar defaults which, with the full benefit of hindsight, are equally bad.

            And don't forget OpenOffice (and forks) handling of the non-existent 29th Feb 1900 [wikipedia.org]. This occurs because Microsoft Excel allowed it. This occurs because Lotus 1-2-3 allowed it.

            If you could produce software which avoids this type of pitfall and is also a category-leader, I would gladly use it. Until then, we're stuck with the quirks of downward compatibility.

            --
            1702845791×2
            • (Score: 1) by GeminiDomino on Saturday August 02 2014, @01:58AM

              by GeminiDomino (661) on Saturday August 02 2014, @01:58AM (#76610)

              None of which has anything to do with the fact that PDO throws an exception that means "No error" when a valid, properly formed INSERT statement is executed. Not sure how the hell OpenOffice and Excel came into the discussion...

              --
              "We've been attacked by the intelligent, educated segment of our culture"
      • (Score: 3, Informative) by urza9814 on Friday August 01 2014, @02:19PM

        by urza9814 (3954) on Friday August 01 2014, @02:19PM (#76384) Journal

        You can't blame things like the ternary operator and mysql_escape_string_i_really_mean_it_this_time() on "illiterate codemonkeys", unless you're talking about the ones designing the language

        First of all, what's wrong with the ternary operator? Sure, it can get ugly if used improperly, but so can anything. It's very nice when used properly though.

        As for the standard mysql_real_escape_string() argument:
        1) you realize nearly all of that stuff has been deprecated for a while now, right?
        2) It exists in PHP because PHP is based on C, and it exists in C! It's not really a PHP function; it comes directly from the MYSQL library.

        • (Score: 1) by GeminiDomino on Saturday August 02 2014, @02:01AM

          by GeminiDomino (661) on Saturday August 02 2014, @02:01AM (#76611)

          First of all, what's wrong with the ternary operator? Sure, it can get ugly if used improperly, but so can anything. It's very nice when used properly though.

          Its assocativity is backwards (it's left associative).

          1) It's only one example of horrible naming in the bloated standard library.
          2) It actually exists because its predecessor mysql_escape_string() was broken, and instead of fixing it and breaking broken code, they squatted more crap into the language. As for being deprecated, that's fine, but the replacement has its own issues (see my original post)

          --
          "We've been attacked by the intelligent, educated segment of our culture"
        • (Score: 2) by tibman on Saturday August 02 2014, @03:22PM

          by tibman (134) Subscriber Badge on Saturday August 02 2014, @03:22PM (#76729)

          I agree, ternary operations and null coalescing are very nice to have.

          --
          SN won't survive on lurkers alone. Write comments.
    • (Score: 1, Interesting) by Anonymous Coward on Friday August 01 2014, @04:44AM

      by Anonymous Coward on Friday August 01 2014, @04:44AM (#76244)

      Years ago our company did a game which was written in PHP, because we couldn't afford to hire programmers experienced in better languages. I remember major annoyances with variable scoping, lack of use strict and loads of SQL escape hassles.

      I think anybody considering learning PHP would probably have a better time learning perl or python and using those to prototype web sites. Those languages are quite a lot saner, and they have great libraries.

    • (Score: 1) by darkfeline on Saturday August 02 2014, @02:11AM

      by darkfeline (1030) on Saturday August 02 2014, @02:11AM (#76614) Homepage

      >Overall, it is a fast and usable language. Very good examples of PHP can be found, such as the wikimedia code. Unfortunately, PHP is dragged down by a culture of illiterate codemonkeys but this is not a fault of the language.

      Really? What say you to this: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ [eev.ee]

      --
      Join the SDF Public Access UNIX System today!
  • (Score: 3, Interesting) by tibman on Friday August 01 2014, @04:46AM

    by tibman (134) Subscriber Badge on Friday August 01 2014, @04:46AM (#76245)

    Most people are going to hate on php, that's okay : ) I get it, it has no "pit of success", just pits. But it's soo flexible. I would pick php over MVC5 but that wouldn't keep me employed. It's not just the language but the whole ecosystem. The hardware requirements to run a full dotNet stack versus a lamp is huge. People would love to put php and javascript into the same box and burn it. Unfortunately for them javascript has made it big and nobody will be displacing it (they've been trying!). I find php and javascript much easier to work with than c# and javascript. Dealing with json and dynamic objects in C# can be a pain at times.

    Anyways, php is primarily a "web language". If anyone starts talking C or C++ then they probably haven't written their own CGI applications lately. Pick the best tool that you are comfortable with for the job. I prefer memory managed dynamic languages when doing web work (PHP and Javascript). C++ for embedded and linux utility. C# for windows applications and services. I've heard great things about python but haven't played with it yet. I've also heard RoR is nice and i do like the MVC pattern.

    In short, people hate the language not because it doesn't work or that it's slow. They hate it because it is inconsistent, unorganized, and unprofessional looking. All qualities that exist for developers and not the clients, i must add. Maybe that's because PHP never had a formal language spec before? Guess what : )

    --
    SN won't survive on lurkers alone. Write comments.
  • (Score: 0) by Anonymous Coward on Friday August 01 2014, @06:25AM

    by Anonymous Coward on Friday August 01 2014, @06:25AM (#76267)

    PHP is definitely the lingua-franca of the internet.

    I just threw up in my mouth a little bit.

    • (Score: 1) by ticho on Friday August 01 2014, @09:52AM

      by ticho (89) on Friday August 01 2014, @09:52AM (#76305) Homepage Journal

      Well, so did I, while copypasting this from the article. :)