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."

120 comments

  1. Hooray fileinfo is standard! by Majik+Sheff · · Score: 1, Flamebait

    Now I don't have to do a song and dance of ugly hacks to get what I need from a file on systems without the extention.

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

    --
    Women are like electronics: you don't know how damaged they are until you try to turn them on.
    1. 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.

    2. Re:Hooray fileinfo is standard! by plague3106 · · Score: 0, Flamebait

      Heh... is it still just inline scripting, or did they come up with embedable contorls, like Asp.net or the java equivolent?

    3. Re:Hooray fileinfo is standard! by nedwidek · · Score: 1, Offtopic

      PHP as I told a manager is useful because it is ubiquitous, not because it is perfect or even particularly good. At the time I worked on a derivative of GForge, which is a definite example of the horrors that can come from PHP projects.

      This is also an original quote by me: "The beauty of PHP is that it is so simple even an idiot can program with it. The problem with PHP is that so many idiots do choose to program in it."

      In my own hosting, I have the choice of using RoR, but the app must be manually redeployed if the server is restarted. So I use CakePHP instead because PHP will be instantly available. :P

      5.3 should be cool, now I just need to start pestering my hosting providers about upgrading.

      --
      Post anonymously - For when your opinion embarrasses even you!
    4. Re:Hooray fileinfo is standard! by thetoadwarrior · · Score: 1, Troll

      I use php and do enjoy it but it is ugly. There is no consistency within the function naming, using -> over . Or any other single symbol is dumb and __construct() but why two underscores? It's unnessary.

    5. Re:Hooray fileinfo is standard! by sopssa · · Score: 1

      5.3 should be cool, now I just need to start pestering my hosting providers about upgrading.

      Dude, dedicated server!

      I also always pick PHP because its so nice to code with it and because of the box it provides so many different functions from many areas. It saves you lots of time and work if you dont need to always write your own functions for everything or google for a library. This is also why I prefer Delphi over C++.

    6. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

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

      I thought that was for every scripting language out there.

      Now I don't have to do a song and dance of ugly hacks to get what I need from a file on systems without the extention.

      Yay, we now have closures and gotos and whatnot to do even more ugly hacking!

    7. 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...
    8. 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
    9. Re:Hooray fileinfo is standard! by -noefordeg- · · Score: 1

      Pfffft!

      Everything changed with the release of Drupal (written in PHP).
      We are creating several large projects each year based on Drupal/PHP and our solutions easily bests any proprietary solutions I've encountered so far.

    10. 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
    11. 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.
    12. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      Yes, yes, every X has its strengths and weaknesses. Please don't pretend that means every X is equivalently valuable, useful, or whatever other definition of "good".

      PHP's only advantage is its ubiquity, which has nothing to do with the language itself and which is generally irrelevant for anyone doing more than throwing up My Free PHP Bulletin Board on Dreamhost. The language itself irredeemably sucks.

    13. Re:Hooray fileinfo is standard! by dkleinsc · · Score: 1

      Having used PHP along with a whole slew of other languages, what I've generally found is that like most other languages PHP is a bit of a slave to its own history.

      For PHP, its origins in dynamic web pages lead it towards results which are quick and often convenient for web designers who are great at making sites pretty, but lacking in design consistency and rigor. Some effects of this are APIs with inconsistent naming and structure compared to other languages, and the prevalence of bad code practices among PHP programmers.

      For Java, the academic background surrounding OOP and design patterns means that it tends to over-engineer for things that are theoretically better but in practice are a big pain. Try juggling dates and you'll see immediately what I mean.

      For Perl, its roots in sed and awk mean that some of the more incomprehensible syntax (designed to make programs fast to type on a PDP-11) is here to stay.

      For Python, it's emphasis on simple syntax means that it's very hard to determine the capabilities of an object just by looking at the code that uses it. Choose bad variable names and you'll be in real trouble.

      And so on. In short, all languages suck, but suck in different ways.

      --
      I am officially gone from /. Long live http://www.soylentnews.com/
    14. Re:Hooray fileinfo is standard! by ari_j · · Score: 1

      It's sad that Slashdot doesn't have an "accomplishment" for the +5 Flamebait. Everyone should strive for one. Oh, and you should get bonus points if it is not a politics or religion article.

    15. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      Apparently you haven't encountered any decent "proprietary solutions" because the code in Drupal is garbage. (Like most open source PHP projects, really.)

    16. Re:Hooray fileinfo is standard! by jbezorg · · Score: 1

      Version 1 & 2 of PHP was a Perl library and was originally named "Personal Home Page Form Processor". That's the original source of the sigil in front of the vars ( and the name "PHP" and a lot of other holdovers ). Version 3 was converted to C.

      --
      I've lost all my marbles except one & It's fun to test angular & centripetal acceleration in my skull
    17. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      ...someone just learned a new word.

    18. Re:Hooray fileinfo is standard! by ultrabot · · Score: 1

      For Python, it's emphasis on simple syntax means that it's very hard to determine the capabilities of an object just by looking at the code that uses it. Choose bad variable names and you'll be in real trouble.

      What the hell does this mean?

      --
      Save your wrists today - switch to Dvorak
    19. 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.

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

      slash-achievements!

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

    21. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      Hi, PHP is a fun programming language and you are wrong.

    22. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      hahhahahhaahhhahh...

      hhahahhahaha

      hahha... as someone reasonably intimate with the code in drupal core, every line is checked and rechecked and the best solution is almost always found.

      if also worked on and with a shit load of crappy proprietary solutions and none of them were worth the time i invested in learning them. coz i have never used them since.

      fuck you troll

    23. Re:Hooray fileinfo is standard! by i_ate_god · · Score: 1

      Well actually that's what the SPL extension aims to achieve.

      http://ca.php.net/manual/en/intro.spl-types.php

      If you want a stronger typed language, this is your solution.

      --
      I'm god, but it's a bit of a drag really...
    24. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      every rose has its thorn
      just like every night has its dawn
      and every cowboy sings a sad, sad song
      every rose has its thorn

    25. Re:Hooray fileinfo is standard! by dkleinsc · · Score: 1

      Here's an example:

      def foo(bar):
              myVar = bar.baz()

      Quick, what methods are available to be called on myVar? Answer: you have no idea, unless you know what bar is, and what bar.baz() returns.

      Don't get me wrong, I like a lot about Python (and actually it's currently my primary language on the job), but it does have some downsides.

      --
      I am officially gone from /. Long live http://www.soylentnews.com/
    26. Re:Hooray fileinfo is standard! by Anonymous Coward · · Score: 0

      For Python, it's emphasis on simple syntax means that it's very hard to determine the capabilities of an object just by looking at the code that uses it. Choose bad variable names and you'll be in real trouble.

      What the hell does this mean?

      ZOMG, he said something vaguely uncomplimentary about Python! Now you must hunt down and burn the heretic!

  2. Missing Feature. by Zarjazz · · Score: 1

    You forgot the most important change of all.

    They added support for "goto".

    1. Re:Missing Feature. by bertoelcon · · Score: 1
      Yes, adding goto in a language automatically adds multiple levels of awesome.

      It doesn't make the code less debug-able at all.

      --
      Anything can be found funny, from a certain point of view.
  3. 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 Anonymous Coward · · Score: 0

      i think it is great! it signifies that PHP is now the "goto" language for web development. like how some people have a "goto" shirt for a pub night.

      now excuse me while i throw up.

       

    3. 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.

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

      Guess the only thing missing now is COMEFROM?

    5. Re:features! by master5o1 · · Score: 1

      Well, we know where we're going. But we don't know where we've been.

      --
      signature is pants
    6. Re:features! by morgan_greywolf · · Score: 1

      Agreed on the GOTO, but as you say, "critical mission error handling may take advantage of a more direct way to 'jump'". Yet, what is 'structured exception handling' like

      try:
              do this
              and that
      except:
              do the other thing
      finally:
              this

      but a syntactic sugar for an "ON ERROR GOTO" like in BASIC?

    7. 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.

    8. Re:features! by Anonymous Coward · · Score: 0

      #shot dooooowwnnnn, in a blaaaze of glooooryyy#

    9. Re:features! by tibman · · Score: 1

      hahaha, thanks for that! I can't believe they put that in the official manual. Too awesome

      --
      http://soylentnews.org/~tibman
    10. Re:features! by torchdragon · · Score: 1

      Where ever you go, there you are.

      --
      "Don't feel bad for me child; I'm the monster that hides under your bed."
    11. Re:features! by iluvcapra · · Score: 1

      GIVE ME THE OVERTHRUSTER!

      --
      Don't blame me, I voted for Baltar.
    12. Re:features! by K.+S.+Kyosuke · · Score: 1

      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".

      Like tail calls instead of gotos? ;-)

      --
      Ezekiel 23:20
    13. Re:features! by Anonymous Coward · · Score: 0

      You really want some of that ASS.NET don't you.

    14. Re:features! by TheSpoom · · Score: 1

      The PHP documentation maintainers just got a +1, Awesome in my book.

      --
      It's better to vote for what you want and not get it than to vote for what you don't want and get it.
      - E. Debs
  4. Would you let it die already? by Anonymous Coward · · Score: 0, Troll

    It's high time we forget about PHP and all it's bain-damaged design

    1. 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.
    2. 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.
    3. Re:Would you let it die already? by zuperduperman · · Score: 1

      You forgot ... create a "terminator" to send back in time and eliminate the millions of moronic PHP hackers who have already created a legacy of horrendous PHP code that the world is now stuck with like radioactive waste from a dirty nuclear bomb.

      Honestly, modern PHP used in a correct manner is tolerable ... but the legacy will never go away and nor will the millions of infected PHP coders who will continue to perpetrate the sins of that legacy into the future. Keeping those people out is actually the number one reason I steer clear of PHP whenever possible these days.

  5. 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 Anonymous Coward · · Score: 0

      Ruby already has all this and Ruby's syntax doesn't look like Perl, C and Java got together and circle-jerked all over my computer screen...

    2. Re:Looking Forward To It by nedwidek · · Score: 1

      Hallelujah on the register_globals. At least magic quotes are now deprecated. Here's looking forward to 6.0 when they are finally removed!! (I've talked to way too many devs who think they are adequate protection against SQL injections)

      --
      Post anonymously - For when your opinion embarrasses even you!
    3. Re:Looking Forward To It by TheRealMindChild · · Score: 0, Flamebait

      PHP is the "new VB". Visual Basic had the stigma that anyone who touched it was a retard and anything produced by it would be retarded. But just like PHP, it was because people with no coding background started with it. It does a whole lot of complicated things for you AND you can still find ways to shoot yourself and coworkers in the face. Ultimately though, if you truly were competent, you could produce some solid work. It's like racism, only toward developers of language X.

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    4. Re:Looking Forward To It by FishWithAHammer · · Score: 0, Troll

      It's also slow as shit, has bad/no real professional support, and looks even worse than PHP.

      Ruby tards are even worse than Python tards.

      --
      "You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
    5. Re:Looking Forward To It by Late+Adopter · · Score: 1

      I don't know VB that well, but PHP has plenty of genuine headaches within it: http://www.tnx.nl/php.html

      So yes, while you can write decent programs in PHP, most good programmers (i.e. the ones who understand the problems) don't want to. Even accounting for good programmers who don't have a choice, you end up with a disproportionate amount of the underskilled in the remainder.

    6. Re:Looking Forward To It by Anonymous Coward · · Score: 0

      It might put a roof over your head and food on the table, but lets face it, as a PHP dev you probably earn peanuts, and both the roof and food are of a shitty quality.

      Myself, I use both Microsoft's MVC framework and Ruby on Rails, and earn so much money I don't know what to do with it all. I suggest you ditch PHP and learn something else.

    7. 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

    8. Re:Looking Forward To It by K.+S.+Kyosuke · · Score: 1

      1) *Every* language has its tards, 2) Ruby is on par with PHP speed-wise, 3) Ruby does have certain strange features, like name resolution order (never wrapped my brain around that), but that hardly affects how a language *looks* like. 'Nuff said.

      --
      Ezekiel 23:20
    9. Re:Looking Forward To It by TheRealMindChild · · Score: 1

      How many quick, one-off apps were EVER made in COBOL? And your description is also what you could say about C++, Object Pascal, *BASIC, Java, .NET Anything...

      Also, VB WAS slow... to the already mentioned "retards". Most of the "slowness" came from constant string concatenation, using implicit type conversions, bad coding practices when instantiating forms with massive ActiveX baggage, Late Binding, COM/Marshaling Transparency, and about 100000 other things that all are avoided by competent people. Visual Basic made it VERY easy to run into these pitfalls and be completely unaware as to why. Blame the developer, however. Not the language.

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    10. Re:Looking Forward To It by FishWithAHammer · · Score: 1

      Does Ruby have an equivalent of APC yet? (JRuby doesn't count.)

      --
      "You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
  6. 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: 1, Insightful

      That's the shittiest login code I've ever seen, and friend, that's saying something.

    2. Re:Horray by Ash-Fox · · Score: 0, Redundant

      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;
      }
      }

      I hope that code is a joke...

      --
      Change is certain; progress is not obligatory.
    3. Re:Horray by Anonymous Coward · · Score: 0

      Some kind of "daily WTF" troll, it seems.

      OTOH, I can't imagine PHP article used for anything apart from trolling (like the Perl articles a while back, and Ruby articles one year from now).

    4. Re:Horray by chord.wav · · Score: 1

      STAY AWAY FROM THE KEYBOARD RIGHT NOW!! That's it, easy, let go... That's all gonna be alright... (Pst! Somebody call 911..)

    5. Re:Horray by Anonymous Coward · · Score: 0

      You can hope all you want, but that's better than a lot of legacy PHP code I've seen. Did you know that, for PHP programmers, base64 is a password encryption method?

    6. 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.

    7. Re:Horray by Ractive · · Score: 1

      Well... it was modded funny, so it should be.

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

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

    9. Re:Horray by neoform · · Score: 1

      They just haven't been introduced to htmlspecialchars() yet. Best damn encryption I've ever seen, and the cool part is you can read some of the encrypted data, that way you can better organize it without having to decrypt it.

      --
      MABASPLOOM!
    10. Re:Horray by jbezorg · · Score: 1

      LOL... I'm a PHP programmer.

      *sigh* Someone a few posts up basically said this: "A language so simple an idiot can us it... so a lot of idiots do.". Sadly, I have to agree. A majority don't know what SQL injection or HTTP Response Splitting is.

      --
      I've lost all my marbles except one & It's fun to test angular & centripetal acceleration in my skull
    11. Re:Horray by FredFredrickson · · Score: 1

      ....but some of us do!

      Not all PHP coders are idiots. I code in many different languages that are required of me while I'm at work. But for some reason I just love how easy it is to put something together in PHP when I'm home playing with some hobby code..

      --
      Belief? Hope? Preference?The Existential Vortex
    12. Re:Horray by jbezorg · · Score: 1

      I've been doing code reviews for PHP novices and sub-contractors lately and it's had it's /facepalm moments. I did have the pleasure of introducing them to little bobby tables though.

      --
      I've lost all my marbles except one & It's fun to test angular & centripetal acceleration in my skull
  7. 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.
    2. Re:My best feature... by raju1kabir · · Score: 1

      How could you jump into the middle of a loop or a switch statement? It doesn't make sense. Essential context is missing. They ruled that out for a good reason; it's like teleporting into a blender.

      --
      "Patriotism is your conviction that this country is superior to all other countries because you were born in it." -- GBS
  8. Namespaces...about time! by javacowboy · · Score: 1

    The lack of namespaces in any programming language is a massive car wreck just waiting to happen. I once spent a few days trying to resolve an issue with a web portal application with different components brought together where the issue was caused entirely by a function name collision.

    --
    This space left intentionally blank.
    1. Re:Namespaces...about time! by SOOPRcow · · Score: 1

      Don't get me wrong, I love that they've added namespaces but I hate how they've implemented it with the backslashes.

    2. Re:Namespaces...about time! by truthsearch · · Score: 1

      You didn't get a "function already exists" type of error when it was redeclared? Strange.

    3. Re:Namespaces...about time! by Canazza · · Score: 1

      the testing server likely had error_reporting set to 0

      --
      It pays to be obvious, especially if you have a reputation for being subtle.
  9. It's true! by 3.5+stripes · · Score: 1

    Years of php programming have danaged my bain to!

    --


    He tried to kill me with a forklift!
  10. 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
    2. Re:new features in php 5.3 by caseih · · Score: 1

      The backslash name separator looks awful to me, although I've always found PHP code kind of garish with all the dollar signs and curly braces. Although it's at least readable compared to some perl I've seen!

      Looking at the "what's new" list I see the cool new feature of php archives. .phar files are zips or tarballs that can be included all at once in your program. Seeing that brings up something I've always struggled with in PHP. When should one use "include," "include_once," "require," or "require_once?" Seems like include normally just inserts the included file into the current source code as if it was there to begin with, no? I guess in the past without namespaces that's probably what most people needed most of the time. And after converting my development wholesale to python with it's inherent namespaces (which are really just singleton objects bound to a local name), it seems like PHP's system is a bit convoluted.

    3. Re:new features in php 5.3 by i_ate_god · · Score: 1

      The backslash name separator looks awful to me, although I've always found PHP code kind of garish with all the dollar signs and curly braces. Although it's at least readable compared to some perl I've seen!

      Looking at the "what's new" list I see the cool new feature of php archives. .phar files are zips or tarballs that can be included all at once in your program. Seeing that brings up something I've always struggled with in PHP. When should one use "include," "include_once," "require," or "require_once?" Seems like include normally just inserts the included file into the current source code as if it was there to begin with, no? I guess in the past without namespaces that's probably what most people needed most of the time. And after converting my development wholesale to python with it's inherent namespaces (which are really just singleton objects bound to a local name), it seems like PHP's system is a bit convoluted.

      In a nicely made OOP application, you should never have to explicitly use require/include and instead use a class autoloader.

      --
      I'm god, but it's a bit of a drag really...
    4. Re:new features in php 5.3 by ari_j · · Score: 1

      This is slashdot. We only link to blogs. Preferably blogs that only link to other blogs. Sometimes we link to digg or fark.

    5. Re:new features in php 5.3 by Anonymous Coward · · Score: 0

      I disagree. I prefer require()s to explicitly specify requirements for objects and libraries.

    6. Re:new features in php 5.3 by greywire · · Score: 1

      Unfortunately traits did not make it into 5.3.

      Which sucks because I thought that was one the coolest new things.

      --
      -- Senior Software Engineer, Attorney appearance services, locallawyerapp.com.
  11. Nuisances by wytcld · · Score: 1

    Let's say you've been using PHP since about a month after Rasmus released it 15 years back, so you've got a whole lot of code that uses the ereg family of regex functions. So they've depricated them, and plan to yank them from PHP 6. Why? Is the overhead so terrible? Or do they really think that it will improve our lives if we have to go back through everything and translate eregs to pregs?

    Then there's the change in MySQL password formats. Sure, if they include the latest MySQL libraries they have a different encryption level. But if PHP is smart enough to warn you about that when your MySQL install is still using the older passwords, then PHP should be smart enough to include both libraries and use whichever one is appropriate to the passwords encountered.

    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. Needlessly.

    --
    "with their freedom lost all virtue lose" - Milton
    1. Re:Nuisances by KiltedKnight · · Score: 1

      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. Needlessly.

      Given the current state of the economy, this is how you can help keep PHP programmers employed... and why you have a test environment where you install new stuff like this before deploying it across your platforms... so you can find all of the pitfalls, traps, changes, etc, without causing your site to fall down and go boom.

      --
      OCO is Loco
    2. Re:Nuisances by amicusNYCL · · Score: 1

      They've been talking about these changes for a long, long time. If you're still using ereg, or register globals, or magic quotes, or whatever else you want to complain about them changing, then that's your problem. If you have important code laying around that you haven't looked through yet, you might want to pencil that in. There's no reason to have PHP4-only code sitting around these days.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    3. Re:Nuisances by tibman · · Score: 1

      Change is almost always painful and scary but you'll be happy for it in the end. Update the code and be glad they don't stay backwards compatable to every iteration of the language.

      It's better to clean up and remove the old stuff and continue improving the language. They don't have enough resources to bugfix and improve such a lengthy/aging codebase.

      --
      http://soylentnews.org/~tibman
    4. 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.

    5. 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.

    6. Re:Nuisances by profplump · · Score: 1

      They really think having regex functions that aren't binary safe is a bad idea -- besides the obviously disastrous results when used for input validation it also means that ereg cannot support unicode. Plus it's just extra code that there's little reason to continue patching and porting a decade after it has been superseded by faster, safer functions.

    7. Re:Nuisances by Anonymous Coward · · Score: 0

      No, we're supposed to have the resources to do it for every php page on the planet. It sucks. This is why I can't stand PHP.

      It's fine if they do this on major releases. 4, 5, 6... but not on point releases. You have to use them for security. It's not cool.

    8. Re:Nuisances by atamido · · Score: 1

      Is there somewhere that lists all of the functions that are about to be deprecated? I've used ereg several times in the past few months and am going to have to go and replace those now. It would be nice to avoid the extra work in the future.

    9. Re:Nuisances by searlea · · Score: 1

      Theres a list of functions deprecated in PHP 5.3. I can't find an official list for PHP 6 though.

    10. Re:Nuisances by Anonymous Coward · · Score: 0

      function mysql_password($passStr)
      { // from somewhere on php.net, can't remember which page... // note that mysql have changed the way passwords work // so this function corresponds to MYSQL_OLDPASSWORD on newer databases.
              $nr=0x50305735;
              $nr2=0x12345671;
              $add=7;
              $charArr = preg_split("//", $passStr);

              foreach ($charArr as $char)
              {
                            if (($char == '') || ($char == ' ') || ($char == '\t')) continue;
                            $charVal = ord($char);
                                $nr ^= ((($nr & 63) + $add) * $charVal) + ($nr 8);
                            $nr2 += ($nr2 8) ^ $nr;
                                $add += $charVal;
              }

              return sprintf("%08x%08x", ($nr & 0x7fffffff), ($nr2 & 0x7fffffff));
      } // from http://www.puremango.co.uk/2005/02/online_tools_76/

  12. me first .. :) by rs232 · · Score: 1

    What feeture is PHP missing already, otherwise I would use it :)

    --
    davecb5620@gmail.com
  13. Namespaces by Parker+Lewis · · Score: 1

    OH-MY-GOD! Nobody complaining about the weird namespace separator!

  14. nt4 by Sicnarf · · Score: 1

    as of this version, windows nt 4 will no longer be supported :-(

    1. Re:nt4 by VGPowerlord · · Score: 1

      NT4 is 12 years old at this point. Is this really a surprise?

      I mean, its successor (Windows 2000), is already 9 years old!

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  15. Building object-oriented modular PHP applications by Anonymous Coward · · Score: 0

    Separation of concerns is a concept in object-oriented (OO) software design that allows you to build more-modular applications. Modular applications are easier to maintain and add new features to. PHP's OO language features allow you to apply design concepts to build more robust, maintainable applications.

  16. Re:Namespaces by neoform · · Score: 1

    That's probably because no one will be using them due to their hideousness.

    --
    MABASPLOOM!
  17. Re:Building object-oriented modular PHP applicatio by K.+S.+Kyosuke · · Score: 1

    Separation of concerns is a concept in *all* schools of software design. Only retards think that it was OOP that brought us namespaces, modularity, exceptions, polymorphism and things like that.

    --
    Ezekiel 23:20
  18. Re:Building object-oriented modular PHP applicatio by WillKemp · · Score: 1

    Looks like that link's slashdotted! IBM? Surely not?!

  19. The main issue with PHP is highlighted here. by a_karbon_devel_005 · · Score: 1

    The PHP development team has no vision, and they haven't ever had one. It's a hodgepodge that started out to be a "web perl" way back in the day, but then Java developers started using it and so 5 looked more and more Java-esque, but obviously being Java isn't their vision either. Take the namespacing in this release. They are using the BACKSPACE as the namespace separator. It's f'ing awful and inconsistent, but they wanted to jam it into 5.3 ... even though Dimitri had a patch that would have used "::" for the separator, the PHP devs didn't want to use it because it would have to go in PHP 6. That's because, just like the inconsistent library arguments, the PHP developer community, like it's user base, is "practical" .. they will sacrifice correctness for easiness. It's the same reason there's no way to flip a php.ini directive and have annoying warnings/errors turned into exceptions instead... "It's hard (because our codebase is shitty.)" PHP sucks, but it doesn't matter to most. It's too popular. But it does suck because there's no consistent vision for it.

  20. Comparison PHP - Java by Nicopa · · Score: 1, Troll

    Some time ago I *had* to work with PHP. I haven't known it before that. Now I hate it =). At that time I wrote a comparison, out of anger about PHP being so much used. This is the comparison Java - PHP I have wrote.

    1. 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.

    2. Re:Comparison PHP - Java by Nicopa · · Score: 1

      In my experience, in a modern server PHP uses more CPU than Java. You might be right about slow machines though. I don't understand why you make such a big deal about servlets vs jsp, as jsp is just a technology to ease the construction of servlets (every jsp gets converted into a servlet)... And I don't agree you can't compare PHP to Java, they try to serve the same purpose.

    3. Re:Comparison PHP - Java by tarius8105 · · Score: 1

      In my experience, in a modern server PHP uses more CPU than Java. You might be right about slow machines though. I don't understand why you make such a big deal about servlets vs jsp, as jsp is just a technology to ease the construction of servlets (every jsp gets converted into a servlet)... And I don't agree you can't compare PHP to Java, they try to serve the same purpose.

      They serve same purpose, but they both werent invented for the same purpose. Out of the two PHP was designed from the ground up to just serve dynamic webpages, and that is its primary purpose. Java on the other hand is designed as an all purpose language.

  21. A serious question by lawpoop · · Score: 1

    Can anyone give an example of a good use of lambdas in php? I'd appreciate both 1. A situation where you would *have* to use it ( or the way to do it without lambdas is such an ugly, counter-intuitive hack that no one would do it ), and 2. an example of where you might use lambdas naturally.

    I've been trying to figure them out since they were announced for 5.3. I think I understand them, but I don't know whey or where you would want to use them.

    --
    Computers are useless. They can only give you answers.
    -- Pablo Picasso
    1. Re:A serious question by Anonymous Coward · · Score: 1, Informative

      It might be easier to think about them as anonymous functions than as lambdas / closures, though they're both.

      They can fit anywhere that used to take a callback. For example, array_walk() and array_map() can be written in a much more sane way, without having to create an external function and refer to it by name.

  22. But PHP is shit! by UK+Boz · · Score: 1

    Blah de blah PHP is shit because [insert random piece of php code that a programmer could use if they were a complete fuckwit] Everyone should use [insert my favorite scripting language] because [insert totally irrelevant feature nobody give a fuck about]

    --
    www.boznz.com Simple solutions to complex problems.
  23. And now the waiting.. by greywire · · Score: 1

    .. begins! Maybe in another 2 years we'll get this into CentOS/Redhat.

    And by the looks of it, we might see PHP 6 around the same time we return to the moon.

    (and I choose the space program as a comparison to another endeavor that seems to be progressing at a rediculously slow pace)

    --
    -- Senior Software Engineer, Attorney appearance services, locallawyerapp.com.