Slashdot Mirror


PHP 5.3 Released

Sudheer writes "The PHP development team is proud to announce the immediate release of PHP 5.3.0. This release is a major improvement in the 5.X series, which includes a large number of new features and bug fixes. Some of the key new features include: namespaces, late static binding, closures, optional garbage collection for cyclic references, new extensions (like ext/phar, ext/intl and ext/fileinfo), over 140 bug fixes and much more."

26 of 120 comments (clear)

  1. features! by Lord+Ender · · Score: 2, Informative

    PHP now comes with more GOTO!

    --
    A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    1. Re:features! by ScytheBlade1 · · Score: 4, Funny

      Pffft. If you're going to say that, you had better include the link to the documentation: http://us.php.net/goto

      ... scroll down.......

    2. Re:features! by vivaoporto · · Score: 2, Insightful

      GOTO has its uses. I never used it (as I prefer a more structured way to code), but critical mission error handling may take advantage of a more direct way to "jump". Anyway, one excepcional addition to the language is closures. Real anonymous functions were missing for a long time on the language, and it is great to have it now. Now it is only a matter of our customers' hosting providers to update their versions of PHP. Oh, well, considering most just migrated from PHP 4 to 5 (thanks to the EOL last year), it may take some time.

    3. Re:features! by Seth+Kriticos · · Score: 3, Funny

      Guess the only thing missing now is COMEFROM?

    4. Re:features! by vivaoporto · · Score: 3, Insightful

      I didn't said "exception handling", but "error handling", like linux kernel developers use.

      Anyway, exceptions in languages like Java which enforces its treatment in compile time are more than just a "goto error handling". It all depends on the language you are using.

  2. Looking Forward To It by TheNinjaroach · · Score: 4, Insightful

    Say what you will about PHP, but it puts food on my table and a good roof over my head. I have been clamoring for the new features in PHP 5.3.0 (closures, namespaces, they finally killed register_globals) and can't wait for the improvements coming in 6.

    I truly appreciate the hard work of the PHP development team and the free language they have given us, congratulations on the new release.

    --
    I went to eat some animal crackers and the box said, "Do not eat if seal is broken." I opened the box and sure enough..
    1. Re:Looking Forward To It by Ant+P. · · Score: 2, Insightful

      No, no no. PHP is the "new COBOL". It's a horrible language, but it's built up too much inertia to get rid of it or most of its backward-compatibility disasters.

      If you want the new VB take a look at Ruby - a language that lets you bring any webserver to its knees in only 5 minutes and 10* lines of code, no experience required.

      *plus 800000 lines of framework

  3. Horray by neoform · · Score: 5, Funny

    So does this mean I should upgrade from PHP 3.2? Are there any incompatibilities with my existing code?

    Maybe someone can look over my login script and tell me if this will work in PHP5?

    $query_login="select * FROM user";
    $result_login = mysql_query($query_login) or die("Your passwrod is might be bad I think");
    //$login_check = mysql_num_rows($result_login);
    while($row=mysql_fetch_array($result_login))
    {
    $username=$row["username"];
    if ($username==$username1)
    {
    echo "";
    echo "window.location.href='login_error.php?rec=qq';";
    echo "";
    exit;
    }
    }

    --
    MABASPLOOM!
    1. Re:Horray by Anonymous Coward · · Score: 5, Funny

      If you can't tell that the parent post is a joke you're probably a PHP programmer.

    2. Re:Horray by Ant+P. · · Score: 2, Funny

      Don't get your hopes up... I've seen real code that's worse.

  4. My best feature... by bogaboga · · Score: 2, Funny

    ...is the ability to employ goto, though it is not allowed to jump into a loop or switch statement. A fatal error is issued in such cases.

    1. Re:My best feature... by Canazza · · Score: 2, Funny

      so it's goto, but not as we know it?

      --
      It pays to be obvious, especially if you have a reputation for being subtle.
  5. Re:Would you let it die already? by MightyMartian · · Score: 2, Insightful

    I don't think that's quite fair. I think if the functions, calling conventions and naming were regularized, it would be a reasonably decent scripting language. But it's because it suffers multiple personality disorder that it's a horrendous pain.

    --
    The world's burning. Moped Jesus spotted on I50. Details at 11.
  6. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 2, Funny

    Oh wait, almost any PHP project eventually gets reduced to a song and dance of ugly hacks.

    *sigh* Yes, yes, we know, and Python or insert-your-pet-language-here is a gloriously clean and not-at-all counterintuitive* wonderland of fantasy and enchantment where fairies and elves smile upon you and give you their blessings and unicorns piss rainbows and shit candy.

    At least until the next hip, trendy language comes out. How's your Ruby on Rails coding coming along?

    *: Obviously, because if anyone finds it counterintuitive and an ugly hack, they are wrong and ugly and stupid and smell funny so there.

  7. new features in php 5.3 by whoisthis · · Score: 2, Informative

    see whats new in PHP 5.3. Namespaces, phar, Closures & Lambdas, Functors, Traits,Magic functions. See link above for examples.

    1. Re:new features in php 5.3 by amicusNYCL · · Score: 4, Informative

      You can also read the official release announcement instead of some random guy's blog.

      http://php.net/releases/5_3_0.php

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  8. Re:Nuisances by DragonWriter · · Score: 2, Insightful

    There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this? When 5.3 rolls out through the distros a whole lot of MySQL backends will fail on the password thing. And when 6.0 rolls out millions of regexs will suddenly be failing.

    Uh, no.

    Assuming that people running and maintaining the code are paying any attention, when 6.0 rolls out, those installations that have working code relying on features long-announced for deprecation that are removed in 6.0 will not upgrade to 6.0.

    Major new interpreter versions enable new projects, and old projects can be migrated to them if there is a reason. But they aren't intended to be minor, backward compatible, performance improvement and bug fix releases -- that's why they are called major versions.

  9. Re:Would you let it die already? by iluvcapra · · Score: 4, Insightful

    I think if the functions, calling conventions and naming were regularized

    ...and they removed the sigils, and removed the silent type coercion, and eliminated the "@" function prefix, and removed the "global" keyword, and removed the weird "list" lvalue function that looks-like-functional-pattern-matching-but-really-just-cosmetically, and fixed the pass-by-reference semantic...

    But if you did all of these things, it really wouldn't be PHP anymore.

    --
    Don't blame me, I voted for Baltar.
  10. Re:Hooray fileinfo is standard! by i_ate_god · · Score: 3, Insightful

    __construct() is a magic method, just like __get(), __set(), __destruct(), __isset(), __toString(), so on and so forth. Magic methods are called without the programmer having to call them, under specific circumstances. In the case of __construct(), it's called when an object is instantiated. '__' defines a magic method and was chosen back in the day because PHP didn't have protected/private members and so the common practice was to prefix private/protected members with one underscore.

    PHP was a solution to Perl, so -> is what Perl uses so that's what PHP uses.

    The function naming is not so much an issue either. But what is frustrating is argument order. That's something that really needs to be revamped, backwards compatibility be damned.

    --
    I'm god, but it's a bit of a drag really...
  11. Re:Hooray fileinfo is standard! by not+already+in+use · · Score: 2, Insightful
    It's funny how people cling to languages for arbitrary and sometimes downright illogical reasons. It's like each language is cool or acceptable in various online social circles. In fact, they can be broken down into their equivalent high school archetype:
    • PHP - The Slackers
    • .NET - The Jocks
    • C - The Goths/Hardcore
    • Ruby - The Hipsters
    • Haskell - The Nerds
    • Java - The drifters

    In seriousness, I'm with the OP. I wish the ridiculous language evangelism would stop. In the end, people are just being short sighted and limiting the tools at their disposal.

    --
    Similes are like metaphors
  12. Re:Nuisances by Stan+Vassilev · · Score: 3, Informative

    There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this?

    Nothing is broken. Ereg is moved to the 'official' extension pack called PECL, which you can use for full backwards compatibility. At the same time the community has been warning not to use the ereg functions for the past at least 3-4 years, if not more, citing worse performance, worse featureset, and the possibility of PCRE replacing it at some point in the future.

  13. Re:Hooray fileinfo is standard! by K.+S.+Kyosuke · · Score: 2, Interesting

    What am I, as a Schemer? A minimalist? A chess player? But seriously, I always saw PHP as one of the prime examples of cargo cult language design. "Perl has strings in front of variables, let's copy them, gods will be pleased." Obviously no one cared that in Perl, the sigil has some actual meaning, like in shell, unlike in PHP, where the single type of variables could be handled the same way it is handled in Python, Ruby, stc. And then the adoption of that strange Java-like OOP system, quite weird for a dynamically typed language. Another cargo cult thinking? "Let's make a cargo plane out of wood and straw, soon the big birds will drop us more crates."

    --
    Ezekiel 23:20
  14. Re:Hooray fileinfo is standard! by Majik+Sheff · · Score: 3, Interesting

    Thank you, you got the gist of my post.

    Every language has its strengths, weaknesses, glaringly awful bits, shiningly wonderful bits, and all of the subculture that go with those things. No language is perfect or even acceptable for every job.

    PHP is an extremely organic language. It is the result of hundreds of developers' efforts and the inclusion of many modules that were once addons.

    I've been using it since very early version 3.0, so I know why things are named the way they are. That doesn't make them any more consistent and it certainly doesn't make old code that grew up with the language any less correspondingly organic (read ugly and hackish).

    Also, you forgot:

    C++ - The emo kids
    C# - The wannabes
    BASIC - Special Education
    Brainfuck - The kid who bit someone in third grade and now eats at his own table because he growls slightly too often

    etc etc.

    I'm hoping I can get a few more Underrated mods, I'd LOVE to have my first +5 Flamebait.

    --
    Women are like electronics: you don't know how damaged they are until you try to turn them on.
  15. Re:Hooray fileinfo is standard! by searlea · · Score: 2, Informative

    Assuming your argument-order frustration lies with the classic needle/haystack inconsistency throughout the string and array functions, the whole issue goes away if the PHP guys would simply evolve the string and array natives to be treated like objects:


    in_array($needle, $haystack) -> $array->contains($needle)
    strpos($haystack, $needle) -> $string->pos($needle)
    etc.

    Do that, and people will naturally migrate from the old inconsistent methods and move towards the more natural and consistent new methods without breaking anything.

    If you really think it's worth breaking backwards compatibility, you could implement a friends suggestion - adding the PHP version number to the <?php wrapper: i.e. change to <?php6 ... ?>. Job done.

  16. Re:Hooray fileinfo is standard! by andi75 · · Score: 2, Funny

    slash-achievements!

    Achievement unlocked: [ Post 5 consecutive posts using the Preview button first ]

  17. Re:Comparison PHP - Java by tarius8105 · · Score: 2, Insightful

    Your comparison is off. Working at a company that has over 1000 java applications, I can tell you right now that you're so off. Simple fact, on a slower machine php will outshine java in terms of performance. On a enterprise powerhouse, the performance is about the same give or take based on how both are written. Its also not a fair comparison to compare java servlets to php. PHP to JSP is a fair comparison and your comparison would still be off base especially with the execution model. You cant compare PHP to Java on the same playing field as they are just that different.