Slashdot Mirror


An Early Look At What's Coming In PHP V6

IndioMan writes "In this article, learn about the new PHP V6 features in detail. Learn how it is easier to use, more secure, and more suitable for internationalization. New PHP V6 features include improved support for Unicode, clean-up of several functions, improved extensions, engine additions, changes to OO functions, and PHP additions." Update — May 7th at 16:47 GMT by SS: IBM seems to have removed the article linked in the summary. Here's a different yet related article about the future of PHP, but it's a year old.

72 of 307 comments (clear)

  1. Finally by Anonymous Coward · · Score: 2, Insightful

    It's about time PHP has native support for unicode.

    1. Re:Finally by sopssa · · Score: 4, Interesting

      One thing I hope PHP would have is GUI stuff for both Windows and Linux. Its a great language for everything, and I use it constantly for scripts and other stuff. I've even written ircbots and servers with it, and they all work great and are nice to work with.

      However the GUI design with the existing tools is just pain in the ass, and it doesnt offer a good way to turn your code into machine code.

      I do understand that theres programming languages like c/c++ and delphi and several others, but from all of those php is the nicest to use, even for non-webpages stuff.

      I dont think it would be that hard to implement such, given theres people to do it and understand how PHP can be greatly used for non-webserver stuff aswell. Or is there something against it that I havent thought of?

    2. Re:Finally by ShawnCplus · · Score: 2, Insightful

      There is the PHP GTK project but I'm a PHP developer and even I'm wondering why you would choose PHP for developing a GUI desktop app.

      --
      Excuse me while I gather the virgin sacrifice and assemble the pentagram required to solve your problem
    3. Re:Finally by rho · · Score: 4, Insightful

      Ubiquity is a pretty compelling feature.

      I mean, BeOS is pretty bitchin', but I'm not spending any of my time on developing applications for it.

      --
      Potato chips are a by-yourself food.
    4. Re:Finally by clone53421 · · Score: 4, Funny

      Too bad Slashdot still wonâ(TM)t.

      I mean, won't.

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
    5. Re:Finally by dgatwood · · Score: 4, Interesting

      Because it's syntactically similar to C. It's remarkably close to what C++ should have been---C with classes, integrated hashes, variable-length arrays, and usable string manipulation. Thus, for long-time C programmers, it's a very natural language to pick.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    6. Re:Finally by ShawnCplus · · Score: 3, Interesting

      I've programmed in both C and C++ and I've used PHP GTK and I'd choose X86 Assembler to build a GUI before I choose PHP for desktop GUI development. And all of the benefits you mentioned are almost completely alleviated with Boost

      --
      Excuse me while I gather the virgin sacrifice and assemble the pentagram required to solve your problem
    7. Re:Finally by Yvan256 · · Score: 2, Funny

      But you can use Boost with any language, I don't see your point.

    8. Re:Finally by Yvan256 · · Score: 5, Funny

      That's so cliché.

    9. Re:Finally by spanky+the+monk · · Score: 2, Funny

      No, just ubiquity.

    10. Re:Finally by zoips · · Score: 2, Informative

      You should check out Pike. Lot nicer than PHP and still has all of those things you mentioned.

    11. Re:Finally by ooloogi · · Score: 3, Interesting

      I didn't mind PHP until I tried porting a a PHP text processing application I'd written into C++. The conversion into C++ (with STL and Boost) was essentially line-for-line, so the lines of code was the same, but the C++ was more readable. The PHP runtime was 32ms, while the C++ was 1.9ms.

      Even in PHP territory, PHP wasn't giving any advantages, but several disadvantages.

    12. Re:Finally by dgatwood · · Score: 3, Informative

      PHP is much, much closer to C than C++ with truckloads of STL piled on top. Ask a C programmer to comprehend that mess and you'll likely have a suicide on your hands. It is very un-C-like. The point is that the PHP syntax for arrays is very nearly identical in behavior and syntax to C, just with lots of extra functionality (variable length associative array). I never said that C++ couldn't do those things, but as far as I've seen, when you do it in C++, you're generally way off the deep end as far as being syntactically familiar to C programmers.

      I guess what it comes down to is this: if you think templates are elegant, then we will never agree about what makes a good language design. From my perspective, templates are what happens when somebody forgets that we have a perfectly good C preprocessor and decides to reinvent the wheel with a clumsy syntax that doesn't provide anything more than what C preprocessing could already provide, wedging the concept into the language itself for no apparent reason. It is anathema. It is absolutely the antithesis of good language design.

      As for OO in PHP, I don't see why you think dynamic typing decreases the value of object-oriented programming. If you really are mostly using the same code with different underlying types, then there's little point in doing OO, but in my experience, that's the exception rather than the rule. Most of the situations where I've used OO with polymorphism, I've had polymorphism, but the underlying implementation has differed substantially, and the only thing similar was the method name (and the general concept for what the function does).

      Also, it is nice to use classes even when you don't need polymorphism. This reduces pollution of the global function namespace. It also makes it easy to create complex data structures that make life easier. (PHP doesn't have the notion of a struct, so you have to either use a class or an associative array.)

      Finally PHP is still very much a typed language. It's not like there is no notion of types and everything is polymorphic with everything. The type of a variable is determined when the variable is assigned, and some types can be coerced into other types in certain use cases, but it isn't universal. I can't do if ($arrayA < $scalarB), for example. PHP even has the notion of casting to force type conversion just like you do in C. For example:

      function myfunc($mynumber) {
      $mynumber = (int)$mynumber;
      ...
      }

      Dynamic typing doesn't mean the types aren't there. If you call a method on an object that doesn't exist on that object, it is still an error. And so on. Dynamic typing just makes it a little easier to shoot yourself in the foot by not throwing up an error when you make the assignment or function call in the first place. :-)

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    13. Re:Finally by dgatwood · · Score: 2, Informative

      There's nothing preventing a native foreach notation built into the language instead of glued on. They just didn't do it that way, and they should have.

      would you explain how you implement a generic container using the preprocessor

      Sure. It's pretty easy. You just define two macros (e.g. BASE_TYPE and ARRAY_TYPE) and then #include a header.

      #define BASE_TYPE uint64_t *
      #define ARRAY_TYPE uint64_t_pointer
      #include <CustomArray.h>

      And in CustomArray.h>:

      #define MAX_SIZE 32

      class ARRAY_TYPE
      {
      BASE_TYPE[MAX_SIZE];

      }

      This is, of course, a trivial example. If you really want to get fancy, you can take advantage of token gluing.

      #include <NewCustomArray.h>

      And in that header:

      #define MAX_SIZE 32
      #define ARRAY_TYPE Array_##BASE_TYPE
      #define ARRAY_PTRTYPENAME Array_##BASE_TYPE##_ptr
      #define ARRAY_PTRTYPE Array_##BASE_TYPE *

      class ARRAY_TYPE
      {
      BASE_TYPE[MAX_SIZE];

      }
      class ARRAY_PTRTYPENAME
      {
      ARRAY_PTRTYPE[MAX_SIZE];

      }

      And simultaneously create two classes, one for pointers to the type, one for the bare type. About the only place where this wouldn't work is if BASE_TYPE is "void" (since that makes no sense as a nonpointer type), and you can fix that with a simple preprocessor test.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    14. Re:Finally by dgatwood · · Score: 2, Informative

      No, there's nothing preventing you from including that header file multiple times for different types. That's the beauty of token gluing. It concatenates the base type as part of the name of the derived array type, so you can create arbitrary numbers of them for arbitrary types. And unlike the template class, whenever you use the resulting type, it just looks like an ordinary C++ class instance with no need for template parameters. Thus, when you actually use the class, you just use "Array_int *foo" or whatever. Outside the syntax in the header file itself (which I'll admit isn't pretty), the usage syntax is cleaner this way.

      Regarding the amount of code, in terms of file length, the C preprocessor version will generally be shorter in the long run. You only have to build the classes once, included from one file. Everywhere else, you just use an opaque forward reference to the class, e.g. "class Array_int;". The header for defining the class also is shorter; although you have the extra couple of macros up front, you save at least as many bytes over the course of the file by not having to litter it with template parameters everywhere. Ditto for the other source files.

      And in terms of code generation, it's exactly the same amount of compiled code; the C++ compiler is generating separate classes under the hood for each of those base types. The only difference is that with preprocessor macros, you create the class explicitly up front with its own name so the instantiation syntax is cleaner.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

  2. So... by msh104 · · Score: 4, Informative

    without wanting to be overly sarcastic..

    What features are they gonne break this time?

    1. Re:So... by 77Punker · · Score: 4, Insightful

      Gotta break some eggs to make an omelet.

      Hopefully this will include cleaning up the argument lists of the string and array functions so that they hall take f($needle, $haystack) in a consistent order. Fixing the argument lists isn't in TFA, but it's a really obvious place to start.

      At work, it may give me an excuse to rewrite a horrible old app that's been holding us back since the days of PHP4. I suspect I am not alone in wanting to see some old (buggy, slow, insecure, poorly designed) PHP apps get ruined so that they can be redeveloped now that PHP5 is actually a decent language.

    2. Re:So... by msh104 · · Score: 4, Informative

      At my work we host and have build and maintain a little over 200 php websites. We host them all ourselves. ( the CMS that we use is build in PHP )

      We earn money from both the hosting and the developing.

      Many of our customers don't want to pay for the porting of their websites to PHP5, let alone PHP6. usually this requires upgrading the CMS as well, making modifications to custom extentions written by outsourcing partys, etc. All in all quite expensive for the site owner.

      "Threatening" them with PHP4 server shutdowns only makes them go away to other hosting providers that will over PHP4 to them.

      So we ended up virtualising all the PHP4 sites together with a good backup system and making our customers understand that we provide no warrenty anymore. We will help them when things blow up on an paid per hour basis.

      Another problem is that we cannot reuse a lot of our code anymore now. Many of our new plugins require php5 so we have to modify them to make them php4 compatible again.

      when php6 comes out we will have to support three different php versions... the horrors of that vision already scare me today..

    3. Re:So... by msh104 · · Score: 3, Interesting

      I wouldn't mind, but my boss likes to get paid when i work for him...

      A general upgrade project we run looks like:

      1. We talk to the customer that the site that WE wrote for him now sucks because WE wrote it with function xyz that is now broken and sucks. ( we formulate this different, but this is about how it feels to the customer )

      2. customer complains that he paid for his site and that he expects it to just work.

      3. we explain that our knowledge of what will happen to future versions of the product is rather limited and that we therefore in principle can only make the best dessisions at a given time, that we regret the problems, but cannot help it. we then usually evaluate the components that are used in the website, CMS version, modules, tweaks, how much was done by outsourcing, etc and send it of to the customer.

      4. customers views the estimate and nearly dies from a heart attack when he sees what it will cost to port his website to a new php version without any increase in function.

      5. if we were lucky in fase 3 / 4 we have been able to get him addicted to some additional services as well that "only work with php5" making the upgrade path somewhat worth it. If that fails the customer in 90% of the cases won't think the upgrade path is worth it and will arange with us that we will keep hosting the site but without warrenty.

      This has not so much to do with being lazy, but more with being in a commercial company and having a customer that does not think it's worth to pay.

    4. Re:So... by msh104 · · Score: 2, Informative

      I wish i was trolling, but trust me, i work for a company that hosts sites, and there is still plenty of php4 around. Most people don't mind the upgrading and staying up to date part so much. But they usually don't like the price that comes attached with it.

    5. Re:So... by ukyoCE · · Score: 2, Informative

      You must be confused, are you thinking of Perl?

      PHP has been VERY careful about breaking features, and have essentially openly mocked the people who suggest they "fix" PHP's functions by randomly swapping argument order on functions that have been working just fine for years.

      The only thing I can think of they've broken is MAGIC_QUOTES and registered globals. Both are Very Bad Things that it was important they do away with. Any sane PHP code will react to their removal by simply removing a few chunks of good that were necessary to route around those features on servers that had them enabled.

    6. Re:So... by ukyoCE · · Score: 2, Interesting

      There are some new features in php 5 and php 6, but besides some worst offenders (magic quotes and registered globals) are entirely backwards compatible with PHP 4 code.

      I had the pleasure of upgrading a Large website from PHP 4 to PHP 5 and it was honestly quite trivial. 5 to 6 will be the same, except for removing the option of turning magic quotes and registered globals back on. But you fixed it the right way from 4 to 5 by not using them anymore anyway, riiiight? :)

    7. Re:So... by amicusNYCL · · Score: 2, Interesting

      I'm sort of curious as to the scope of changes that you actually do to migrate a site, what are you really needing to do that causes the customer to decline, I mean how much work is really necessary? What things are you finding that you need to do consistently to move a site from PHP4? When most people have asked me what might break when they flip the switch on the server to go to PHP5, I usually just talk about the changes in default settings, like register_globals being disabled (which never should have been used in the first place), or safe mode being disabled (which wouldn't have an affect really anyway).

      I'm curious to get your feedback on what kinds of changes actually need to be made though, I've been developing with PHP since before 5 was ready to go, but I really haven't run into very much incompatibility at all as I move things between versions. The biggest problem I have is needing to port something for PHP5 down to PHP4, where I have to find compatible definitions of functions that are now built-in (json_encode comes to mind). And most of the time that happens, I end up convincing them to upgrade to PHP5 once I point out how old both PHP4 and 5 are (PHP5 is almost 5 years old at this point, PHP4 is 9 years old this month).

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

      At least I ruined it by being informative. :P

      Java applets coded back in 1996 still run in the newest JRE. Pretty impressive for the consumer/user, though it must be a nightmare to maintain.

      I'm not aware of any huge changes to Apache Tomcat in the past few years - certainly nothing that required re-coding an entire website from scratch.

    9. Re:So... by jamonterrell · · Score: 2, Funny

      You made a much wiser decision in going with perl. You have virtually no risk of an update coming out that breaks backwards compatibility.

      --
      I can count to 1023 on my hands. Ask me about #132.
  3. So, when will PHP 6 be released? by thue · · Score: 3, Interesting

    All very good. But there is no set release date; I wonder when PHP 6 will be released?

    They have been working on PHP 6 since at least 2005, and from monitoring announcement etc., I haven't seen any signs that they are nearing a release.

    1. Re:So, when will PHP 6 be released? by Burkin · · Score: 2, Funny

      I heard it'll be released the same day as Duke Nukem Forever as 3D Realms will be using it in the relaunch of their site for the game.

    2. Re:So, when will PHP 6 be released? by AndrewNeo · · Score: 2, Informative

      I don't care, as long as they fix all these inconsistencies and everything everyone else complains about, then they can take their time.

  4. Time to pay the piper... by Onyma · · Score: 4, Insightful

    I am definitely no PHP expert so perhaps I am wrong but it seems that much of what is being changed is backtracking due to bad language decisions from the beginning. Sadly I think PHP developers with legacy code are going to be paying the price for several versions to come.

    --
    Play me online? Well you know that I'll beat you. If I ever meet you I'll "/sbin/shutdown -h now" you. -Weird Al, kinda.
    1. Re:Time to pay the piper... by FictionPimp · · Score: 5, Funny

      This is why I never write legacy code, only progressive forward thinking code!

      People who write legacy code are just not thinking of the future.

    2. Re:Time to pay the piper... by Anonymous Coward · · Score: 4, Insightful

      You're not far off track. A lot of PHP's problems stems from the fact that the language itself was more or less kind of thrown together rather than planned out (from the early simple Personal Home Page scripting stuff to PHP3 that just kept extending things and adding more functionality bolted on). They only just began to start to stabalize some of that in PHP4 and really only started to fix a lot of issues in PHP5 and now PHP6. They are making good strides but there's a lot of work to do (and a lot of backwards compatible considerations, I'm sure).

      The good news for PHP developers with legacy code is that they've had a long time to fix things. Stuff that is going away has been deprecated for many versions now so none of this should be a surprise. The people that will get hit are the site administrators using PHP based apps that haven't been updated in forever.

    3. Re:Time to pay the piper... by 77Punker · · Score: 4, Funny

      I think PHP developers with legacy code are going to be paying the price for several versions to come.

      I prefer to call it "job security".

  5. question: by larry+bagina · · Score: 5, Insightful

    are these ass clowns still planning on using \ for namespaces?

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

    1. Re:question: by Anonymous Coward · · Score: 4, Informative

      Yes :(

    2. Re:question: by pizza_milkshake · · Score: 4, Funny

      The worst design decision yet, which is saying something.

    3. Re:question: by Just+Some+Guy · · Score: 4, Funny

      Can you blame them for trying to escape?

      --
      Dewey, what part of this looks like authorities should be involved?
    4. Re:question: by SnapperHead · · Score: 4, Interesting

      They are really going to destroy the language with this idea. Its a *VERY* bad design decision, and they really don't care what the community thinks of it. People suggested using ::: ... that claim its too many characters to type. Ok, how about : or . or one of the other suggestions.

      The decision was made in IRC without any community input. People are very unhappy with it, and they don't care. It almost makes me embarrassed to be a PHP developer.

      Maybe with some luck, a competent development team will fork it.

      --
      until (succeed) try { again(); }
    5. Re:question: by Dragonslicer · · Score: 2, Interesting

      I think it's an incredibly stupid decision too (when we saw the decision at my last job, we decided never to use namespaces just because the separator would look ridiculous), but it still doesn't top register_globals and magic_quotes.

  6. A likely story by Anonymous Coward · · Score: 5, Insightful
    As far as I can tell, PHP 6 is probably a long way off. End of 2009 at the very earliest. Consider this: PHP 5.3 introduced RC1 in March with the idea of 1-2 week intervals, and, here in May, we're still not at RC2.

    Given that PHP 6 was "rumored" to be out at least a year ago. I can't decide if the title "An Early Look" is meant to be ironic, or is just a sad indicator of progress.

    Despite that, I would say that three things have recently happened demonstrating the improvement in quality of PHP:
    1. End of Life of PHP 4
    2. Many important improvments in PHP 5.3
    3. Unicode in PHP 6

    I would say that (1) and (2) easily are more important for the language than is (3). PHP 5.3's improvements should be a huge change: Namespaces (I know there's a huge amount of hate for this implementation: get over it. It's going to be very useful), Closures / Lambda Functions, and Late Static Bindings in particular make it hard to wait so long for PHP 5.3.

    So, stop talking about PHP 6! Lets get PHP 5.3 out.

    1. Re:A likely story by amicusNYCL · · Score: 2, Insightful

      It's no defense, but the guy who started PHP, Rasmus Lerdorf, is apparently a Danish Greenlander, and the two guys who rebuilt the parser for PHP3 and on, and founded Zend, Andy Gutmans and Zeev Suraski, are both Israeli. As I said, it's no defense, but Americans didn't have anything to do with creating PHP.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  7. Limited cleanup by Just+Some+Guy · · Score: 4, Insightful

    clean-up of several functions

    Does that include safe_quote_string_this_time_i_really_freaking_mean_it, or do_foo(needle, haystack) and foo_do(haystack, needle)? At least it gets namespaces after all this time, even if they're almost deliberately ugly.

    --
    Dewey, what part of this looks like authorities should be involved?
    1. Re:Limited cleanup by LWATCDR · · Score: 2, Insightful

      All I want is for $foo[0] and $foo["0"] to not be the same reference.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    2. Re:Limited cleanup by Just+Some+Guy · · Score: 4, Funny

      But that might break something that two people found convenient in 1997 and therefore can never be repudiated.

      --
      Dewey, what part of this looks like authorities should be involved?
  8. Re:Hope it handles Search/Replace better by drpimp · · Score: 3, Informative

    Like any other computer science problem, break it into pieces (think Divide and Conquer). Loading 88MB file into memory is not going to work by default anyhow, unless you set the memory limit in PHP from the default you will get out of memory errors every time. I think even a find/replace in a Windows app like Notepad or Notepad++ will "work" but it will definitely be slow. When I used to search large logs I would use some sort of file splitter and search each file itself.

    --
    -- Brought to you by Carl's JR
  9. My items to be fixed by Parker+Lewis · · Score: 3, Insightful

    My items to fix: - Remove the "goto" statement that will be introduced in 5.3 (WHY JESUS, WHY??); - Stardandize function names (current samples: str_replace, html_ entity_ decode, htmlentities, htmlspecialchars_decode); - Improve array speed (for simple arrays, use internally one simple C array/list - current days, any array is a map); - Insert optional configurations by project (and not by host); - Remove function alias; - Provide optional typing for functions and parameters, but in a simple and consistent way (no strange notations); - Remove old extensions, like PDF paid extensions (and please, insert any open and official PDF extension); - As any language, provide a way of store compiled regex, avoiding compile them all the simple regex call for the same task; - Provide legacy support for PHP5 application as separated download (or at least allow PHP6 and 5 in the same host - we suffer a lot to find PHP5 Hosting in the earlier times, due the impossibility of run PHP4 and 5 at the same host).

    1. Re:My items to be fixed by clone53421 · · Score: 2, Funny

      You also forgot: <p>

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
    2. Re:My items to be fixed by mgkimsal2 · · Score: 2, Insightful


      # Insert optional configurations by project (and not by host);

      -1 You can already do this via .htaccess sans security resourse limits which should be per host on shared hosting.

      .htaccess only works under Apache, and then only in the context of a web request. If I'm working PHP shell scripts, .htaccess is useless to me.

    3. Re:My items to be fixed by nahdude812 · · Score: 2, Informative

      PHP compiles regex's transparently automatically. If you've used a pattern recently, it will not reparse the statement.

    4. Re:My items to be fixed by bluej100 · · Score: 2, Informative

      Improve array speed (for simple arrays, use internally one simple C array/list - current days, any array is a map);

      Try the SplFixedArray class. The SPL data structures are much, much faster. I actually rather like the "easy by default, fast when you need it" dichotomy.

  10. Namespaces by Phroggy · · Score: 4, Interesting

    So let's say you've got a global variable, $n

    And let's say you're using it in a module, Foo

    And because scattering global variables everywhere is a stupid idea that will lead to much pain, let's say you've decided to use namespaces in PHP6.

    Now, in your main script, let's say you happen to be using a variable $Foo, for no particular reason.

    What does this do?

    <?php
    echo "Hello $Foo\n";
    ?>

    --
    $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
    $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    1. Re:Namespaces by ari_j · · Score: 2, Funny

      It'll probably just print 90 copies of an error message that makes sense on the surface but gives no indication of what it actually means.

    2. Re:Namespaces by edsousa · · Score: 3, Insightful

      Say that $Foo=3
      It will print
      Hello 3


      Because the namespace begins with a backslash ('\foo\n') and when using it inside double quoted strings must be "\\foo\\n".

    3. Re:Namespaces by amicusNYCL · · Score: 2, Funny

      Are you telling me that you're confused by this:

      <?php
      echo "Hello $Foo\n";
      ?>

      and then you put this in your sig:

      perl -e 'printf"%02X"x4,unpack"C4",gethostbyname"$_.aacs.phroggy.com" for qw/Just another Perl hacker/'

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    4. Re:Namespaces by amicusNYCL · · Score: 3, Funny

      Gesundheit.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  11. Re:Object Oriented support in PHP by revlayle · · Score: 2, Informative

    PHP5 and, soon 6, is pretty strong. PHP5 has a fairly proper inheritance and member visibility model and is truly reference based (i.e. $objX = $objY means, in PHP5, that they are reference to the same object instance... opposed to PHP4 where $objX = $objY made a FULL copy of the object to $objX). Not perfect, but not bad - the rest of the language/API needs a cleanup, which lookd like v6 will help address.

  12. One of these things is not like the OOthers by Ukab+the+Great · · Score: 5, Insightful

    One of these things just doesn't belong

    python:

    myArray.append(myvalue)

    ruby:

    myArray.push(myvalue)

    objective-c:

    [myArray addObject: myvalue]

    smalltalk:

    myArray add: myvalue

    PHP:

    array_push($myarray, $myvalue)

    1. Re:One of these things is not like the OOthers by ABasketOfPups · · Score: 5, Informative

      Or...

      PHP:
      $myarray[] = $myvalue;

    2. Re:One of these things is not like the OOthers by amicusNYCL · · Score: 2, Interesting

      One of these things just doesn't belong

      hmm.... let's check the rankings at tiobe.com..

      python: 5.548%
      ruby: 2.692%
      objective-c: 0.134%
      smalltalk: 0.125%
      PHP: 9.921%

      So apparently PHP is the one that is not like the others, because the ranking for PHP is more than the rankings for everything else combined.

      http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  13. Well wouldn't you know by omuls+are+tasty · · Score: 5, Insightful

    In the finest tradition of PHP, they made Unicode behaviour dependent on a setting. Have these people learnt nothing from the past? magic_quotes anyone? Bleh. All languages have their warts, but the amount of bad design decisions in this one is just staggering.

    1. Re:Well wouldn't you know by VGPowerlord · · Score: 4, Insightful

      Stack Overflow has a question from last year titled Worst PHP practice found in your experience?. Earlier today, I submitted the answer whose summary is "The worst practice in PHP is having the language's behavior change based on a settings file."

      Great minds think alike!

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  14. Cry me a river by SmallFurryCreature · · Score: 2, Interesting

    Staying up to date is part of doing business. Would you use a cab that still used horses? Get on a steam train with open box carts?

    While progress for progress sake can be overrated the simple fact is that we learn from mistakes and improve on the stuff we make. There comes a time when being conservative turns you into a technical ludite and as a tech company you got to ask yourself, is this worth it?

    Is there a business in supplying coal for instance? Some people still heat their houses with it, but does that mean YOU as a business man have to run a business to supply them?

    Ask yourself, how much time does it cost you to keep the people happy who want PHP4 and how much that same time could have earned you in business from PHP5 customers.

    Go into your local shopping district and you can probably find stores that still cater to people who haven't moved on, who still do their shopping at the corner store. It is quit fun actually, but who would you rather be. The owner of a corner store struggling each day to pay the bills, or the founder of Albery Heyn, the corner store that made it big?

    The hardest thing a good business man has to learn is to learn which customers to let go.

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

  15. New to this version by KingPin27 · · Score: 3, Informative

    they have actually turned off the register_globals feature (really this time it won't work). If you try to use it you get an error message that says RTFM (ERROR: ID-10-T)

    --
    "i lost my dignity on a slippery wiener"
  16. Indeed it does not by SmallFurryCreature · · Score: 2, Insightful

    Market share: PHP 50%, ASP 49%, rest perl.

    When PHP and ASP don't totally dominate the job listings, please come back to me again. In the meantime I know which of the function calls pays for my food.

    Oh and $array[] = $value;

    Coding, you should learn it.

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

    1. Re:Indeed it does not by PCM2 · · Score: 3, Interesting

      Oh and $array[] = $value;
      Coding, you should learn it.

      Or maybe the PHP designers should, cuz I know quite a few programming languages and that syntax does not look like "append a value to an array" to me. It looks more like some kind of borked pointer assignment, or a way or re-initializing an array to contain a single value.

      --
      Breakfast served all day!
  17. Re:Hope it handles Search/Replace better by Just+Some+Guy · · Score: 3, Insightful

    Loading 88MB file into memory is not going to work by default anyhow, unless you set the memory limit in PHP from the default you will get out of memory errors every time. I think even a find/replace in a Windows app like Notepad or Notepad++ will "work" but it will definitely be slow. When I used to search large logs I would use some sort of file splitter and search each file itself.

    And here the rest of us are grepping and sedding multi-gigabyte files without thinking twice. Seriously, what's your idea of a large file?

    --
    Dewey, what part of this looks like authorities should be involved?
  18. Re:Working Link by VGPowerlord · · Score: 2, Funny

    I hate to say it, but this wouldn't be the first time on /. when an article was submitted with a link that was a year or more older and the article made it to the main page. Particularly since the article the GP linked to is a year old to the day.

    I can only imagine the submitter/approver looked at the date, say May 6th, and went "OMG, that's today!!!111"

    --
    GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  19. Re:Hope it handles Search/Replace better by nahdude812 · · Score: 2, Informative

    If you want to process large files (or any large chunks of data such as blob columns) in PHP without loading the entire file into memory, look into streams.

  20. Its like fast food.. by greywire · · Score: 4, Funny

    PHP: its like fast food..

    You know its bad for you...

    You feel like crap after eating it...

    But damnit, its right there, oh so conveniently located on the way to work, and sometimes a greasy cheeseburger just hits the spot, even though you know you'll pay for it later in heartburn and much later in high cholesterol and love handles, even though right now its really cheap on the wallet.

    Its a guilty pleasure.

    And while you're sucking down that greaseball burger, you see the local soup and salad restaraunt and think "next time, I'll eat right.."

    But come the next day and you see that taco joint and..

    --
    -- Senior Software Engineer, Attorney appearance services, locallawyerapp.com.
  21. Javascript anyone? by spanky+the+monk · · Score: 2, Interesting

    I would love to see JavaScript on the server side. It's already way more powerful than php5 with (superior) prototypal oo, higher order/first class functions and many other meta-programming abilities.

    All it needs is some good libraries. There are people already working on this. Soon... soon.

  22. Broken Link in Summary by Udigs · · Score: 5, Informative
  23. Re:Object Oriented support in PHP by Dragonslicer · · Score: 2, Informative

    How good is the object oriented support in PHP these days?

    Everyone involved with PHP pretty openly admits that PHP5's OO model is a direct ripoff of Java, so inheritance, abstracts, interfaces, and access modifiers work pretty much the same way as they do in Java. If you like Java's OO, you should be fine with PHP5's.

  24. Re:Object Oriented support in PHP by shutdown+-p+now · · Score: 2, Insightful

    PHP5 has a fairly proper inheritance and member visibility model and is truly reference based (i.e. $objX = $objY means, in PHP5, that they are reference to the same object instance... opposed to PHP4 where $objX = $objY made a FULL copy of the object to $objX).

    So they've got to the level of Java 1.0. Congratulations!

    Oh, actually, sorry, they didn't, since there are still no namespaces. But there will be soon, and then it'll be at the level of Java 1.0. Once again, congratulations!