Slashdot Mirror


PHP 6 and What to Expect

An anonymous reader writes "Jero has a few interesting thoughts on what PHP 6 is driving towards and provides a nice overview of what has been keeping the PHP team busy lately. For more specifics, PHP.net also has the developers meeting minutes from last November available with a great recap of all the major issues on their platter."

101 comments

  1. the license by ajdlinux · · Score: 0, Offtopic

    My suggested change would be to go back to the GPL instead of the crap PHP license.

    1. Re:the license by lbft · · Score: 1

      I'd love to hear what's so "crap" about the PHP license, and how it's having a negative effect on anything.

    2. Re:the license by Anonymous Coward · · Score: 0

      You say that as if PHP was licenced under GPL at one point. It isn't.

    3. Re:the license by ajdlinux · · Score: 0, Offtopic

      Read debian-legal for a while. Recently there was a huge thread about the freeness (as in RMS, DFSG) of the license and its practical problems.

    4. Re:the license by ajdlinux · · Score: 1

      It was. PHP/FI 2.0 was under the GPL, I believe, and I know that PHP 1.0 definately was. They changed the license because they 'wanted PHP to have better acceptance' and chose a crappy GPL-incompatible, freedom-questionable license.

    5. Re:the license by kuzb · · Score: 3, Informative

      There isn't really anything to hate about the PHP license. It's free to use for business or personal use, and it's distributed in source form so you can poke at the internals. You're allowed to modify it and even redistribute it. I don't see what the problem is here. You're whining about nothing, I suggest you find some cheese to go with it.

      --
      BeauHD. Worst editor since kdawson.
    6. Re:the license by kuzb · · Score: 1

      More likely this is just something you're using to spam your stupid referral links. Mod parent down.

      --
      BeauHD. Worst editor since kdawson.
    7. Re:the license by ajdlinux · · Score: 1

      You couldnt care less about the license as long as it is 'reasonably' free. It has a name-change clause which is annoying if you plan to distribute your changes. It also has other practical problems. Read the thread and find out why.

    8. Re:the license by larry+bagina · · Score: 1
      Lots of free software has a name change clause (either explicitly or via the trademarking of the software name). Ooh, you can't fork PHP and call it PHP. You can't fork TeX and call it TeX either.

      --
      Do you even lift?

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

    9. Re:the license by kuzb · · Score: 1

      So? It's not an unreasonable request for them to maintain the rights to their name. They don't say anywhere that you're not allowed to fork it, all they say is that they don't want you calling it PHP after. Big deal. If this is the only reason to bitch, you don't have a lot of room to bitch. At the end of the day, you're getting something for nothing.

      --
      BeauHD. Worst editor since kdawson.
    10. Re:the license by kuzb · · Score: 1

      And it's a copout. Who cares if you can't change the name. Honestly, I'd reprint the reply, but it would be a waste of time. I've already written it (attached to another silly comment similar to yours) here.

      --
      BeauHD. Worst editor since kdawson.
    11. Re:the license by cparker15 · · Score: 1

      larry wasn't bitching. larry was criticizing ajdlinux.

      --
      Have you driven a fnord... lately?

      You must wait a little bit before using this resource; please try again later.

  2. Article by perlionex · · Score: 3, Informative

    Since jero.net already seems to be /.ed...

    Taking a look at PHP 6

    While most web hosts are still in the PHP 4 era, the PHP developers are already planning and working on PHP 6. Lets have a look at whats been keeping them busy.

    Unicode support

    When youre creating a website, you hardly have to think about the character encoding. You only have to decide how you tell the user agent what encoding youre using, but with a little help of Apaches .htaccess file, you only have to make that decision once. However, if youre building an application, the character encoding might become a problem. Thats where PHPs new Unicode support comes in handy. With its support, PHP can automatically encode and decode the in and output of the script making sure both the database and the user agent receive the encoding they need without the need of any extra functions for the encoding conversion.

    The big cleanup

    PHP is already being used for a long time, creating a big user base, but also a lot of bad habits. Bad habits often result in slow scripts or even security holes. But these bad habits are not always the cause of the developer. Of course, he (lets just assume were dealing with a stereotype developer here for simplicity's sake) is the one whos using it in his application, but sometimes the developer is not even aware hes using it.

    Im, of course, talking about the register_globals , magic_quotes and safe_mode functions. These three functions are hell for every PHP programmer so Im sure everyone will be happy to hear that these functions will disappear in PHP 6.

    In other related cleanup news, register_long_arrays and the long versions of the super globals like $HTTP_COOKIE_VARS are also gone in PHP 6. Same goes for zend.ze1_compatibility_mode which dealt with the backwards compatibility of PHP 5 classes.

    Alternative PHP Cache

    Caching is a very good way to improve the performance of an application. Thats why there was a large demand for a good opcode cache in the default distribution of PHP. And when theres a demand, theres probably also a person or a group to meet that demand. The result is APC: Alternative PHP Cache. Of course, APC was already available a long time ago (01-07-2003), but the PHP developers have decided to include this extension in the core as the default caching framework.

    OO Functionality

    The improved OO model was probably the biggest improvement to PHP in version 5.0. PHP 6 tries to improve this even further by adding namespaces. If youre familiar with XMLs namespaces or maybe C++, you will probably have an idea of how namespaces work. If not: Namespaces can group variables, functions or objects under a certain name. This allows the developer to use the same name for a variable, function or object multiple times. In case youd like to learn more about the possibilities of namespaces, I find this C++ tutorial about namespaces quite useful.

    Changes to the extensions

    PHP is basically a collection of extensions which are all put together to form what we have now. However, these extensions change and so does the collection. Take, for instance, the XML Writer extension. A great extension to write XML files. Its brother, XML Reader, was already added and enabled in the core distribution in PHP 5.1, and now XML Writer will follow its example in PHP 6, forming a great duo to easily work with XML files.

    Another change in the core distribution is the removal of the ereg regular expressions library which is going to be made an extension. ereg is currently used

    1. Re:Article by D'Sphitz · · Score: 1, Flamebait
      Since jero.net already seems to be /.ed...

      No it's not, quit karma whoring

    2. Re:Article by sahrss · · Score: 1

      No it's not, quit karma whoring

      Yes it is, and that was a well-formatted repost. Site won't load for me...

  3. Do most users even need PHP 6? by CRCulver · · Score: 4, Interesting

    I wonder if most of the new features in PHP 6 will even appeal to most users. I started on PHP 4 with O'Reilly's Programming PHP and when PHP 5 came along, I didn't notice anything that was really missing. It's like Perl 6, there are already plenty of people who feel that what they have so far serves their needs, and there's not anything to improve upon.

    1. Re:Do most users even need PHP 6? by lbft · · Score: 1

      It really depends on what you use PHP for, how you like to code, how many people are working on the project, whether you prefer OO or procedural code, whether you mix PHP and HTML or not, and so on.

      I, personally, will probably move to it fairly quickly because I can do it -- noone's going to be too bothered if my personal sites blow up, because I make use of the new features introduced in PHP 5 today, and because I wish for the consistency that PHP lacks right now.

    2. Re:Do most users even need PHP 6? by babbling · · Score: 1

      I reckon Perl's OO support could use a bit of work, but I'm not very experienced with it, so maybe it just takes some getting used to.

    3. Re:Do most users even need PHP 6? by masklinn · · Score: 3, Insightful

      Try some other languages (Ruby, Python, CLisp/Scheme/Haskell/OCaml if you manage to get past the syntax), you'll see that PHP is lacking in many areas.

      Closures (even read-only, as in Python), functions as first-class objects, namespaces, modules, consistency across the standard library, properties, metaobjects, strong typing (not static, strong), infinite-length integers (these dummies want to add a 64bits integer in PHP6... whoa, so kewl eh), good iterators (not Java's, either Ruby style or Python style iteration), partial application (curryfication), pattern matching, ...

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    4. Re:Do most users even need PHP 6? by Anonymous Coward · · Score: 0

      In constrast I love the simplicity of 'an object is just a hash that knows what class it belongs to' (been blessed).

    5. Re:Do most users even need PHP 6? by self+assembled+struc · · Score: 3, Insightful

      I think you're missing his point.

      In my experience (working in large PHP driven shops) the people writing PHP didn't necessarily have a comp sci background. They don't care (and most don't even know) wahat a first-class object is, why they would even want namespaces, strong typing or 64 integers. In fact, adding them to the language makes it in accessible to them, so they'll just stick with php 4, which "works for me."

      I mean, in a fundamental sort of way, yes PHP is broken, but in a useable sort of scripting language way, PHP 4 isn't broken. And if it ain't broke, then don't try to fix it.

  4. Namespace by CHaN_316 · · Score: 3, Insightful

    It'd be great if variables, functions, classes, and constants could be defined in their own namespaces. For really big projects, it's too easy for names to collide in the global namespace. An annoying workaround has always been to make names unique by prepending them with something.

    --
    "There is no spoon." - The Matrix
    1. Re:Namespace by iangoldby · · Score: 5, Informative
      From the article:

      The improved OO model was probably the biggest improvement to PHP in version 5.0. PHP 6 tries to improve this even further by adding namespaces.


      Will this do?
    2. Re:Namespace by larry+bagina · · Score: 1

      it can (sorta) be done in php4/5 via a static class function. Still, it will be a nice addition.

      --
      Do you even lift?

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

    3. Re:Namespace by moro_666 · · Score: 1

      it'd be great if they'd get php5 up and running properly before they put their effort into php6 ;)

      i still get segfaults with xslt processing on every typo that's in the xslt file, so i have no line numbers or even filenames to track down the error that causes it to segfault :S

      other than that, adding a more proper oop support in php5 is a very welcome addition.

      namespaces ? sure they'd be good to use in complex applications, but proper oop code can easilly live without them.

      some fast way for persistant data is still a todo (shared memory via php's own functions really isn't "fast", and storing data into the database all the time is also slow compared to what applications servers and persistant classes could offer.)

      --

      I'd tell you the chances of this story being a dupe, but you wouldn't like it.
    4. Re:Namespace by CHaN_316 · · Score: 1

      It'll do, however OOP isn't the only programming paradigm that people use with PHP. I know quite a few people that use PHP for its functional programming abilities. (Just making conversation, not knocking OOP)

      --
      "There is no spoon." - The Matrix
  5. woohoo! by larry+bagina · · Score: 2, Funny
    I'm glad that register globals and magic quotes will finally (hopefully) be dead. I can't believe they implemented those "features" in the first place, much less made them default. ughh!

    Funyn thing is, in the digg dicussion on php6, most of the people were upset at how much rewriting they'd have to do without register globals or magic quotes! bwahahaha!

    --
    Do you even lift?

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

  6. What's the point? by TerminaMorte · · Score: 0, Troll

    There still isn't wide-spread use of PHP5; why move onto PHP6?
     
    Either not enough people think PHP5 is suitable to their needs (and requires more work), or there isn't enough reason to switch from PHP4 to PHP5.
     
    Either way, it seems that working on PHP6 isn't necessary at the current time.

    1. Re:What's the point? by houseofzeus · · Score: 1

      PHP6 might not be necessary *now*, but it's not like it is coming out tomorrow anyway. At best it will be around a year off still. A lot can change in that time. Would you prefer the devs just sit on their arses for the next 12 months and do nothing?

    2. Re:What's the point? by philipmather · · Score: 1

      No, no, "Dev's" by our very definition sit on out arses and read slashdot fule.

      --
      Regards, Phil
  7. Lack of backwards compatibility by kestasjk · · Score: 4, Interesting

    phpBB, vBulletin, mysqladmin, postnuke, phpDiplomacy (shameless self promotion), etc, etc; none will work until they've been ported to the new PHP5 OO model, and once they've been ported they won't work on PHP4.

    They should leave in backwards compatibility for the class based OO model which <PHP5 uses. Once they bring out PHP6, PHP5 will be the only version which runs new and legacy PHP scripts, so PHP5 will clearly become the standard for a long time.

    I'm a big fan of PHP, but with so many apps (e.g. my university's timetabling app) still in PHP3, all the rest in PHP4, both becoming obsolete, changes to the API, even changes to what's allowed within the same version; I'm starting to wonder if I should have focused on a more stable language like python or perl instead.

    --
    // MD_Update(&m,buf,j);
    1. Re:Lack of backwards compatibility by Anonymous Coward · · Score: 0

      check ruby its good a l33t framework

    2. Re:Lack of backwards compatibility by masklinn · · Score: 1

      Ruby is not a framework god damn it!

      Rails (or Ruby on Rails, RoR) is a framework built on top of Ruby, Ruby is a general-purpose, object oriented, multi-paradigmatic programming language. And a very good one, too.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    3. Re:Lack of backwards compatibility by Anonymous Coward · · Score: 0

      Backwards compatibility is the bane of programming language progression. All you need for backwards compatibility is a versioning mechanism to allow reversion of the interpreter.

      Allow the developers of the language to refactor and you get a better language.

    4. Re:Lack of backwards compatibility by NeoThermic · · Score: 2, Informative

      >phpBB[...]; none will work until they've been ported to the new PHP5 OO model, and once they've been ported they won't work on PHP4.

      I'll note that phpBB 2.0.x was written for PHP3 and PHP4 (those were the only target versions of PHP about when 2.0.0 was released). The fact that 2.0.x works with PHP5 is proof that there's enough backwards compatability with PHP4. The bits that break are proof that there's not enough ;)

      Also, phpBB 3.0 is being wirtten for PHP4 and PHP5, of which it works fine under both right now (although its still in CVS). We did a quick test last week, a CVS build of PHP6 shows no immediate problems with phpBB 3.0 - obviously when it hits beta, this will be tested properly.

      Having delt with lots of support requests, I do note that the split of PHP4 to PHP5 is about 95 to 5 percent. As far as I see it, unless PHP does something drastic like dropping all future support of PHP4, I doubt the uptake of PHP5 will get anywhere decent.

      I will agree though, the PHP language needs to stay stable. The "by reference" change between PHP 5.0.x and PHP 5.1.x is a great example of something that should of been left for PHP6..

      NeoThermic

      --
      Use my link above, or to view my server, NeoThermic.com
    5. Re:Lack of backwards compatibility by elwin_windleaf · · Score: 1

      One of the nasty aspects of web design is the speed of it. The next great standard, the next new browser, all these things impact your code negatively. Talk about an uphill battle!

      After many trial and error experiences, I've started to force myself to segregate different types of information as much as possible. Separate content from markup, markup from script, etc. Times change, and the code you're using will change with them. If you keep different portions of a page separated, it makes it easier to update individual components for the new trends in the industry.

    6. Re:Lack of backwards compatibility by Anonymous Coward · · Score: 0

      There is a pear module for exactly this...

      Look on pear.php.net for PHP_Compat or something

  8. That was "Brokeback PHP" by Philip+K+Dickhead · · Score: 1

    He said, sheepishly.

    --
    "Speaking the Truth in times of universal deceit is a revolutionary act." -- George Orwell
  9. Its not going to attract a bigger audience by oztiks · · Score: 2, Insightful

    The argument why .PHP is seen as being less of a programming language to .NET is its lack of framework support.

    They should finish working on PEAR and getting it properly documented along with getting most of the respoitory packages out of "alpha" release. Then we wont have this stigma about .PHP being not quite enough agaisnt competeing solutions.

    Its good to see that they want to "fine tune" php and they are discussing the important programming syntax elements of the langauge, but like everyone else is saying why move to v5 in the first place? Well for those .PHP hardcore users v5 is really quite nice it does allow for more sparing use of memory and allows for a bit more OO functionality but at the end of the day to make .PHP a usable piece of enterprise software it needs to have a mature framework.

    Otherwise I presonally believe we'll start seeing Ruby hit the scene a bit more and .PHP will be left to catch up.

    1. Re:Its not going to attract a bigger audience by Anonymous Coward · · Score: 0

      PEAR is a component library with parts of a framework (like common error handling for some parts), if you want a framework as-is, there are others, like the upcoming zend framework.
      imho the lack of a framework is not job, a language or even language design should solve, it only should provide the toolset used by a framework.
      but not the framework itself.

    2. Re:Its not going to attract a bigger audience by oztiks · · Score: 1

      According to the PEAR website, it is infact a framework, yes it is a component library but when you are using the PEAR system you see how easy it is to manage various components and you see how quite blaitently it intergrates into eachother.

      EG how the error checking system, "configuration swiss army knife tools", DB intilisation classes and DB objects all tie into PEAR base library then to make it even nicer you have some real cool caching and session management classes which you can incorperate into them; some of it is really quite handy.

      Though, I can see what your saying Mr AC. On a commerical point of view if they want to sell it to enterprise they'll need to focus on the "glazed" abstract elements of .PHP.

      Okay granted the development of .PHP is not supposed to be about developing a set of libraries which encapuslates a various high-end operations such as abstractive interfacing. However, in .PHP v6 they are placing importance on PECL which is again just another library set which is a "part" of the .PHP development.

      PECL, PEAR & Smarty are all relevant parts of .PHP in my view if you want to have a serious enterprise development environment they need to mature such elements.

      At this stage for .PHP development i see the best way is to get the job done is just use bits of PEAR to create your framework to develop from, though this aspect is the time consuming process for some.

      Thanks for pointing out the Zend Framework, defintly worth checking out!

    3. Re:Its not going to attract a bigger audience by I+Like+Pudding · · Score: 1

      Otherwise I presonally believe we'll start seeing Ruby hit the scene a bit more and .PHP will be left to catch up.

      This already happened

    4. Re:Its not going to attract a bigger audience by ^Case^ · · Score: 1
      The argument why .PHP is seen as being less of a programming language to .NET is its lack of framework support.

      Actually .NET is not a programming language, it's a platform. Many languages run on the .NET platform, PHP amongst others.

  10. How about "use strict;" directive by maedls.at · · Score: 1

    This would be really great!!!

    1. Re:How about "use strict;" directive by MavEtJu · · Score: 3, Interesting

      Too true. Declaration of variables, and local variables in blocks, is what keeps preventing me from making stupid mistakes in Perl.

      --
      bash$ :(){ :|:&};:
    2. Re:How about "use strict;" directive by twanvl · · Score: 1

      error_reporting(E_ALL); helps a lot

    3. Re:How about "use strict;" directive by pH7.0 · · Score: 1

      >error_reporting(E_ALL); helps a lot

      E_STRICT is ever better!

      http://ca3.php.net/manual/en/ref.errorfunc.php#e-s trict

      BTW, "taint" checks would be useful too and Ruby style "Safe Levels"

    4. Re:How about "use strict;" directive by wizbit · · Score: 1

      Try E_STRICT, which for some reason is not included in E_ALL (though the meeting notes state they'll change this for PHP6).

  11. Namespacing and Unicode by shutdown+-p+now · · Score: 1
    Namespacing and first-class Unicode strings are two things PHP is still seriously lacking. Now that they are promised in PHP6, it will finally be... er... an average modern language roughly on par with Python feature-wise?

    Seriously though, apart from its popularity, is there any reason to choose PHP over the multitude of other existing solutions?

    1. Re:Namespacing and Unicode by Ginger+Unicorn · · Score: 1
      I worked on some rather ambitiously complicated content management projects for a couple of years in PHP4 and i have to say it was a bit of a toy language.

      I started designing an App framework for PHP5 (since it has rudimentary OO support) to eliminate wheel reinvention for even trivial requirements like data/type validation. But then Ruby on Rails came out and it looked like exactly what i was trying to do except on a better foundation and with someone else doing all the work ;)

      PHP4/5 seemed scrappy, but PHP5 was heading in the right direction. I'd be interested to see how PHP6 turns out. To be honest i think Ruby/Perl/Python are just much better alternatives to PHP full stop.

      --
      (1.21 gigawatts) / (88 miles per hour) = 30 757 874 newtons
    2. Re:Namespacing and Unicode by masklinn · · Score: 1

      Seriously though, apart from its popularity, is there any reason to choose PHP over the multitude of other existing solutions?

      If you actually know how to code, not really, no.

      On the plus side, it's extremely easy to get started (just create a .php file and start emitting a mess of PHP and HTML) which is good for 2-pages stuff or for beginners (not good as in "teaches you how to code", but good as in "well at least it does something, and you don't even have to being understanding how it does it), on the minus side, it's a half baked language and that kind of starts get ugly and messy really fast.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    3. Re:Namespacing and Unicode by Anonymous Coward · · Score: 0

      It's popular because It Just Works.

      And most importantly, it doesn't force the programmer to add boilerplate code everywhere to get the HTTP headers set up right. Some other languages apparently see this as OK, and those are the languages PHP is getting its new users from.

    4. Re:Namespacing and Unicode by Anonymous Coward · · Score: 0

      Popularity is a good attribute...

      If you are looking for people to work doing coding for you and you have a project in RoR or Python, you will find it hard to find cheap local coders to maintain etc. This means that all the great Web 2.0 business plansd go out of the window because you cant find reliable local coders.

      "it's a half baked language and that kind of starts get ugly and messy really fast."

      I think what you really mean is that a lot of people can write half-baked code which becomes unstable quickly. Code is only as good as the design + coder.

      If PHP 6 was 'on-par' or even off par from Python, it would still be the better choice for business. Remember business is there to make money (ie spend as little as possible to get as much income as possible), you cant make money if your business grinds to a halt because you cant find programmers.

    5. Re:Namespacing and Unicode by shutdown+-p+now · · Score: 1

      Unfortunately, no, it doesn't "just work right". It merely makes a very convincing illusion at the first glance, and by the time you begin to see the problems (the mess which is php.ini and the way it affects language semantics alone is a sure killer of the "just works" approach), it is already too late to switch.

    6. Re:Namespacing and Unicode by masklinn · · Score: 1

      If you are looking for people to work doing coding for you and you have a project in RoR or Python, you will find it hard to find cheap local coders to maintain etc. This means that all the great Web 2.0 business plansd go out of the window because you cant find reliable local coders.

      Reliable isn't cheap. Good isn't cheap either. Good web apps, innovative "web 2.0" stuff, isn't created by grunts. You need intelligent people, builders with a vision and abilities. There are smart people in the PHP trade, a lot of them, but the number of PHP guys is so high that most of the PHP coders are actually grunts. That's much less the case for RoR (at the moment at least) or Python. Read Paul Graham's "The Python Paradox" and Joel Spolsky's "Hitting the High Note" for more informations on the concept of "having cheap coders available isn't necessarily a good thing".

      I think what you really mean is that a lot of people can write half-baked code which becomes unstable quickly. Code is only as good as the design + coder.

      No, I mean that PHP promotes bad code, sloppy code, and that PHP requires an extremely high level of work and dedication to actually be kept clean, especially when multiple coders are involved in the application. PHP is akin to Perl scripts without use strict;. Ruby or Python, on the other hand, promote readability and clean code, it nearly takes more effort to write sloppy code than to write good code.

      Remember business is there to make money (ie spend as little as possible to get as much income as possible), you cant make money if your business grinds to a halt because you cant find programmers.

      You see programmers as you'd see pens or desks, furnitures, go for the lowest price, you'll save more.

      Successful (web) businesses didn't start that way, they started with the smart guys, they started with the rare, interresting languages, check Amazon for example, want to know the requirements they had when it started? Which languages were allowed? C and Lisp. period. They didn't go for the numbers, and they never feared not being able to find programmers. Because they were smart guys, and they knew that there were other smart guys that knew Lisp out there, and that they could eventually get them if they needed, especially if the other smart guys had to code in Java or C++ for a living at their current jobs.

      Using a "great" language (Python, Ruby, Lisp) instead of using a well-spread one (PHP) gives you less choice when you want programmers, but it gives you a smarter average population instead of grunts, and it gives you people who can give up on perks because you'll allow them to use a language they actually like. It gives you people who wouldn't hesitate jumping ships to come to you.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    7. Re:Namespacing and Unicode by name773 · · Score: 1

      the manual is amazing

  12. Great... by Anonymous Coward · · Score: 0

    more non-type-safe, unstructured, convoluted crap for the unwashed...

  13. GOTO? by Two9A · · Score: 2, Insightful

    Admittedly, I didn't RTFA, but 'goto' is almost definite to be included in PHP6 upon release. Do we really need this pandering to the VB migration crowd, sacrificing code structure for the sake of a bigger PHP userbase?

    --
    xkcdsw: the unofficial archive of Making xkcd Slightly Worse
    1. Re:GOTO? by Musteval · · Score: 0

      You don't have to use it. All it'll really do is break the webpages of bad VB programmers. And that's generally an improvement on not having them broken. So it's win-win!

      --
      Note to mods: I'm probably being sarcastic.
    2. Re:GOTO? by Anonymous Coward · · Score: 0

      If you honestly think that an inclusion of 'goto' in any language is pandering to the VB crowd, then you obviously need to do more research. 'goto', by far, out dates VB. Its continual inclusion in languages is not based upon any original design decisions by Microsoft or their copycats.

    3. Re:GOTO? by shabble · · Score: 1
      Admittedly, I didn't RTFA, but 'goto' is almost definite to be included in PHP6 upon release.
      Perhaps you should try RTFA (yeah, yeah, this is slashdot, blah blah...) From http://www.php.net/~derick/meeting-notes.html#addi ng-goto
      The name "goto" is misleading, and often associated with BAD THINGS(tm). Because our proposed solution is not a real GOTO construct, we will instead reuse the "break" keyword, and extend it with a static label.
    4. Re:GOTO? by aurb · · Score: 1

      Real Programmers aren't afraid to use GOTO's.

    5. Re:GOTO? by ultranova · · Score: 1

      Admittedly, I didn't RTFA, but 'goto' is almost definite to be included in PHP6 upon release. Do we really need this pandering to the VB migration crowd, sacrificing code structure for the sake of a bigger PHP userbase?

      The whole noise against goto is utterly pointless. If your functions are large enough that goto makes them unreadable, you should break them up anyway. And if you insist on keeping them intact, then using goto islikely to result in a lot cleaner code than monstrous multi-layered block structures.

      With block structures, it is easy to get confused on which level belongs to which if statement, especially if the block doesn't fit to the screen all at once. With goto, it is always completely clear where it leads to, at least if the labels have been properly selected.

      Overusing goto to create spaghetti code is an amateur mistake, but so is feeling some kind of instinctual revulsion towards it, and avoiding using it to maintain some imagined "purity" of code.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    6. Re:GOTO? by dedazo · · Score: 1
      pandering to the VB migration crowd

      Interestingly enough, I've seen more GOTOs in 'hardcore' C code (just look at the Linux kernel) than I ever saw on VB. So what's your excuse for hating VB?

      --
      Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
    7. Re:GOTO? by Schraegstrichpunkt · · Score: 1

      Shhh! How are we supposed to avoid people like this if you keep teaching them how to sound like they know what they're talking about?

  14. PHP needs serious redesigns by tehshen · · Score: 4, Insightful

    No, seriously. PHP has accumulated a lot of broken things over the years, and it is hurting it. This new version of PHP should be turned into a whole new language entirely, or made incompatible with older versions (like Perl 6 is doing). Reasons:

    PHP's design is fucked up. Some functions have underscores, others don't; some have numbers, others don't: strtolower, isset, stripslashes compared with hex2bin, is_null and strip_tags to name a few. Why? Who knows? But too many applications rely on these inconsistencies, and making them consistent would break everything.

    It has no namespaces. Luckily, they are to be added in PHP 6 (and about time too!), so we can do $db::connect() rather than mysql_connect($db). So can we get rid of all the mysql_* and other pseudo-namespace functions please? They are annoying and will be wholly unnecessary.

    Security problems. Register_globals and magic_quotes are still built into PHP when they should be built out and as far away from it as possible (and they are!). There are going to be people who will wonder why this upgrade breaks those things, and people should know that a new language does things differently. (Likewise: Perl 6's given/when block isn't called switch/case because it behaves differently).

    Now that I've typed all that, much of my reasoning is that people rely on PHP's being bad. People should never rely on poor language design, or bugs, or bloat, of which PHP has loads. The language should work, you shouldn't need to work around the language - and if you do, you're going to have a lot of trouble rewriting your code.

    There might be little incentive to switch away from older versions of PHP for some people, but a few refinements of the language won't change that. "Better than PHP" would actually be true. "Made from the PHP team" would be a major selling point too.

    I know that it's a bit risky saying this here (there seem to be a lot of people who like PHP for some reason), but a serious redesign is in order, and it's more than just a simple bumping up of the version number can fix.

    --
    Guy asked me for a quarter for a cup of coffee. So I bit him.
    1. Re:PHP needs serious redesigns by Anonymous Coward · · Score: 0

      a bit rude, but i concur. i've been working with it for too long not to be immensely annoyed at it's design, or lack thereof.

    2. Re:PHP needs serious redesigns by TheCarlMau · · Score: 1

      I completely agree about just creating a new language. Keeping things backwards compatiable just messes up future releases.

      The lesson learned here is that computers should not try to act smart (magic quotes and register globals). I am smart enough to add_slashes() my input.

    3. Re:PHP needs serious redesigns by Anonymous Coward · · Score: 0

      so we can do $db::connect() rather than mysql_connect($db)

      Because $db = new PDO($connectString) isn't good enough? Seriously, I haven't used mysql_*() for over a year now. I wrote my own database abstraction layer long ago, then found out about PDO, which works even better.

      All that needs to happen now is to cut the cruft out, which is what they're doing with PHP6. Those mysql_*() functions are going to be tossed out of core into a PECL module. If your app needs them, use that module. If you've written something more modern, don't. Problem solved, and namespaces weren't the fix.

      Now that I've typed all that, much of my reasoning is that people rely on PHP's being bad. People should never rely on poor language design, or bugs, or bloat, of which PHP has loads. The language should work, you shouldn't need to work around the language - and if you do, you're going to have a lot of trouble rewriting your code.

      No. Just, no. PHP is not a bad or poorly designed language. It does not have bugs or bloat. PHP is a very clean, lean, and usable language. The PHP standard libraries are awful . The library of functions provided by the core module are inconsistent in their naming and actions. There are gotchas in every one of them, and they're big enough gotchas that people learn to just go look for gotchas before using a PHP core library function. But again, that core library is going to be made into PECL modules, and new libraries will replace it.

      The "simple bumping up of the version number" is going to signify a pretty good set of real fixes this time around.

    4. Re:PHP needs serious redesigns by Sentry21 · · Score: 1
      It has no namespaces. Luckily, they are to be added in PHP 6 (and about time too!), so we can do $db::connect() rather than mysql_connect($db). So can we get rid of all the mysql_* and other pseudo-namespace functions please? They are annoying and will be wholly unnecessary.

      You mean we could do something like this?

      $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
      foreach ($dbh->query('SELECT * from FOO') as $row) {
      print_r($row);
      }
      $dbh = null;

      Wouldn't that be neat? This is actually what PDO is going to provide, and is exactly what you want, without having to use namespacing, thanks to PHP's OOP features.

      In actuality, your example is a terrible use of namespaces. More useful would be to be able to do things like $connection = mysql::connect(), which is really no more or less useful than $connection = mysql_connect();

      Unlike languages like perl (from what I can tell), functions in PHP are not generally named arbitrarily. PHP modules like the MySQL extension or the SQLite extension are generally thin wrappers around C libraries (the SQLite module, for example, took on the order of an hour or two to write). PHP developers writing modules generally name the functions they create the same as the functions they are using. PHP's lack of namespaces has not generally been an issue in this case because C lacks namespaces as well. Hence, the mysql_real_escape() PHP function maps to the mysql_real_escape() C function - the name was not chosen by the PHP devs.

      The only place that namespaces will help is with C libraries that clutter the global namespace (examples of which I can't really recall - are there any?), or have terse, difficult-to-remember names - e.g. strstr(), strcmp(), strrev(), etc. Moving these to string::replace(), string::reverse() and so on would be handy, but then string_replace() and string_reverse() is just as useful.

      Faked namespacing using ext_ as opposed to real namespacing with ext:: doesn't seem to make much difference in terms of anything other than code style however - as I understand, other languages provide facilities like 'use CGI' for example, which import modules into the namespace - PHP's functions and extensions are generally done in C code and loaded as modules, meaning that they are either loaded and available, or unloaded and not available. There is no performance hit to be had from the global namespace. Perhaps I misunderstand the PHP architecture on this point, but from what I know, this is the case.

      As for your other points, people always rely on poor language features in any language. To many people, the 'do { x } unless (foo)' syntax that perl provides is absurd; the use of '$|++' to enable output buffering is incomprehensible to anyone who's used a language without such terseness, and the idea of declaring arrays with @ but referring to them with $ is confusing to begin with (though easy to understand and get used to).

      The people who still use register_globals, short_tags, magic_quotes, etc. are either ignorant or lazy. THey are either following tutorials that are three years old, or they have legacy applications that they have not bothered to update. I myself have a few hosted websites for friends and acquaintances, and after several warnings to one particular individual, I disabled short_tags for good - if he was too lazy to upgrade (which was the case), then I was not going to suffer for it.

      I welcome PHP6's incompatibilities, because largely, it is incompatible only with 'features' that have been off by default for several years, and deprecated for even more. Anyone who did not see this coming is blind, and I have no sympathy for anyone whose applications break. It will either force programmers to fix their broken code, or it will force users to switch to applications that are written well in the first place. Which one happens, I care not.

      I am looking forward to PHP for a great many reasons, and I can't wait to roll it out o

    5. Re:PHP needs serious redesigns by aevans · · Score: 1

      [PHP's design is fucked up. Some functions have underscores, others don't; some have numbers, others don't]

      This is the sum of your critique of the language!?! You don't like the name of some of the functions that are included with it?!?

      For $5 I'll sell you a patched PHP, just give me your list of preferred functions, and you can have (apparently) the perfectly designed language.

      I say Perl's design is fucked up. The different sigils are on different parts of the keyboard. @ isn't next to % and by god, $ comes after @ on the keyboard. If only @ meant scalar, # meant array, and $ meant hash, then it'd be the perfect language design. Only Perl 6 (if it ever gets written) really does fuck up sigils because @foo[$i] doesn't mean anything.

    6. Re:PHP needs serious redesigns by TheCarlMau · · Score: 1

      I agree with your convenience point. I believe that without the absolutely excellent manual over at php.net, PHP would not be as popular. I use the manual every single day--and it's free!

    7. Re:PHP needs serious redesigns by Anonymous Coward · · Score: 0

      I dont see how this troll of a post made it too +4 in insightful! You mods must suck a lot of .NET cock to allow such a thing!

    8. Re:PHP needs serious redesigns by Schraegstrichpunkt · · Score: 1

      Ok, but PLEASE don't trust the user comments. The suggestions are almost certainly wrong, and are often dangerous.

  15. Web hosts should be offering more choice by MikeRT · · Score: 2, Interesting

    I have yet to see a major web host that offers Python Server Pages support which just so happens to be a standard feature of mod_python. The single biggest reason why PHP is so popular is that it is a free alternative to ASP with a modestly lower learning curve. Not to troll, but I'd like to make a bet here. If web hosts made inline Python, Ruby and Perl modules like mod_python availible to their users, few people would choose PHP over those three. The hardcore would choose Perl Server Pages, the uber-geeks would choose Ruby Server Pages and the rest would, rationally, choose Python Server Pages.

    1. Re:Web hosts should be offering more choice by AnotherDaveB · · Score: 1

      Is there a reason PHP scripting is included in the cheapest packages and the others aren't?

    2. Re:Web hosts should be offering more choice by aevans · · Score: 2, Interesting

      actually, there is a very good reason to not use python for HTML template scripting, and anyone who's used JSP knows why, despite what the python users say about "using a proper text editor"

    3. Re:Web hosts should be offering more choice by Schraegstrichpunkt · · Score: 1

      Could you enlighten those of us who haven't used JSP?

  16. Alternative PHP Cache by Karamchand · · Score: 1

    It's a pity they decided in favor of APC and not eAccelerator (the successor of turck mmcache), which is a lot faster in my experience.

    1. Re:Alternative PHP Cache by radixvir · · Score: 1

      they state in the notes that they chose it because APC is released under the PHP license so they can include it with the release. I know Bart is going to be working on redoing all the eaccelerator code so he can change it to the PHP license as well but that will take considerable time. I also wonder whether it would still be enough. Ive seen benchmarks that put eAccelerator in front of Zends own product, which Zend must not be too happy about. But its good to see at least some caching be put out there even if its only memory-caching. Then maybe many ISPs will go ahead and turn it on instead of having no caching at all.

  17. Jeeez... by tokamoka · · Score: 1

    Honestly, the way some of you bitches bitch anyone would think that PHP6 is a step backwards rather than forwards. I can't really see anything wrong with the language maturing. If it brings it more inline with some peoples definition of a "proper" language, then that's surely something to be commended - right?. Sure some of the updates are a bit late, but I'd hazard a guess that this is so due to purely pragmatic reasons, which y'know, is something that we can all appreciate in a way.

    One thing I'm really looking forwards to is the native Caching and UTF-8 support (missing from Ruby).


    --
    Tokamoka

  18. Mod Parent Up by JordanL · · Score: 1

    I don't understand why he's been modded down for this post. The website it came from is (at least partially) inaccessable, and it saved me a trip to google's cache, for which I am very thankful.

    Sometimes I wonder if slashdot moderators don't go around and look at posts saying, "yeah... yeah, that one's a post other's would like to read... -1 Offtopic... heh heh... I just modded a good post bad... heh heh... I feel better about myself now..." *rolls eyes*

    Mod this post all the way down to hell if you want. I got karma to burn.

    1. Re:Mod Parent Up by Schraegstrichpunkt · · Score: 1

      No, they usually use "Overrated" =)

  19. a better thing could be .... by 0b1010100 · · Score: 1

    to make PHP strong typed!!

    1. Re:a better thing could be .... by penguin-collective · · Score: 1

      PHP is strongly typed, it just isn't statically typed. Learn the difference before you complain!

  20. PHP's biggest problem by rnd() · · Score: 3, Informative

    Nobody has pointed out the biggest problem with PHP5, and it doesn't appear to be addressed in PHP6: Exception handling.

    PHP5 came with exception handling like that found in most mature object oriented languages, but the problem is that most PHP functions do not use exceptions, they simply return false.

    This makes it difficult to use exception handling at all, because you have to mix the old way and the new way if you want to leverage PHP's huge library of functions.

    I think the solution would be to implement standard exception behavior for all of the old libraries and add a setting in php.ini to turn the behavior on or off.

    It's easy to write a PHP script that will fail without throwing an exception or returning a boolean value that can be handled. This makes PHP very difficult to use if you need your code to be very robust and solid. I've resorted to using classes and putting some code in the destructor to clean up if the script terminates unexpectedly, but this is ugly and should be something that one can handle by enclosing the error-prone logic in a try/catch block.

    Needless to say, this problem isn't always a major issue for websites, but if you're doing anything more complicated than simple db lookups and printing HTML, robustness matters and PHP's shortcomings really stand out.

    Partially due to this problem I recently switched a fairly large project to Ruby on Rails and have been EXTREMELY pleased with how fast development has progressed. I was able to reproduce 2 months of PHP development in rails in 2 weeks, learning curve included. Ruby is a joy to program with, way easier than PHP, C#, Python, etc.

    --

    Amazing magic tricks

    1. Re:PHP's biggest problem by miyako · · Score: 2, Informative

      Actually, they mentioned this in the article. It was decided that they would not use exceptions for built in functions, because they couldn't decide where to draw the line between throwing an exception and halting the interpreter.
      I agree that it would be a nice option to have, though in my experience the only language I've worked with on any regular basis where people actually use try/catch blocks instead of the return false way is in Java, which requires it.

      --
      Famous Last Words: "hmm...wikipedia says it's edible"
    2. Re:PHP's biggest problem by rnd() · · Score: 1

      Seems strange to just halt the interpreter under any circumstances. Why not give the programmer the choice about what happens?

      C# support exceptions very similar to Java's and they're not required, but they are available to create robust code when it is needed, unlike PHP.

      Ruby also has a similar mechanism with slightly different syntax; optional but highly useful.

      --

      Amazing magic tricks

  21. [OT] Re:Lack of backwards compatibility by kchrist · · Score: 1

    phpDiplomacy (shameless self promotion)

    I'm a big fan of PHP


    You must be, you named your application after it.

    Since I've never spoken to the developer of any other php* app, let me ask you something: Why on earth did you name your software after the language you wrote it in? What happens if you later decide to port your app to Perl or Ruby?

    This is common for PHP devs for some reason, yet you never see it anywhere else. I heard Rasmus Lerdof speak a few years ago and he expressed his puzzlement (and annoyance) at this phenomenon.

    1. Re:[OT] Re:Lack of backwards compatibility by kestasjk · · Score: 1

      If you hear phpDiplomacy you already can be pretty sure it's a web based, database driven app; it gives you an idea of what to expect, and if you've already heard of the board game 'Diplomacy' then you'll already know what phpDiplomacy is.
      I can't imagine it being called anything else which makes you think "web based implementation of Diplomacy" the moment you read the title.

      --
      // MD_Update(&m,buf,j);
    2. Re:[OT] Re:Lack of backwards compatibility by Uerige · · Score: 1

      "Web Diplomacy"?

  22. Argh, WAMP by Kittie+Rose · · Score: 1

    I had a lot of trouble when I was setting up a website at work because PHP was the wrong version. I hope that this new one doesn't cause any issues with the existing WAMP configuration(or LAMP for that matter).

    --
    EpiAdv - if you like Pokey the Penguin, try this comic!
  23. PSP web browser reading a PSP page with PSP images by tepples · · Score: 1

    I have yet to see a major web host that offers Python Server Pages support

    Possibly because the abbreviation is already overloaded. As the developer of Luminesweeper, a clone of a PlayStation Portable flagship title, puts it: "Where I come from, PSP is still Corel Paint Shop Pro."

  24. PEAR documentation is terrible... by WoTG · · Score: 1

    I still can't understand why PEAR doesn't get the same user contributable documentation system that PHP uses! Time and time again I've tried to use a new PEAR module only to be completely befuddled with the lack of examples and documentation. IMHO, PEAR usage would grow substantially if the docs were better. Don't get me wrong, the folks who have put the code up are great, and they do try; however, it's an uphill battle. It's just so much easier if end-users could chip in with the docs. And yes, I have mentioned this on a forum or a bug tracker or something --- 3 years ago.

  25. Want UTF-savvy string functions for PHP? by smagruder · · Score: 1

    Check out this recent article by Harry Fuecks.

    From the article: "PHP UTF-8 is intended to make it possible to handle UTF-8 encoded strings in PHP, without requiring the mbstring extension (although it uses mbstring if it's available). In short, it provides versions of PHP's string functions (pretty much everything you'll find on this list), prefixed with utf_ and aware of UTF-8 encoding (that 1character >= 1 byte). It also gives you some tools to help check UTF-8 strings for "well formedness", strip bad sequences and some "ASCII helpers"."

    --
    Steve Magruder, Metro Foodist
  26. set error handler/level by Zaharazod · · Score: 1

    If you're worried about use of undeclared variables, this is not impossible to detect, though slightly more complicated than "use strict".. set the error level to E_NOTICE and set up a custom error handler to throw an exception (or abort) when it gets called with the uninitialized variable code. (You could also set it to simply log a warning somewhere, as it is possible, and useful, in some cases to rely on uninitialized==false..) (I know its not one line.. but its quite a bit more flexible, and after all, timtowtdi :)

  27. Go and punish yourself with PHP. Meanwhile I have by Anonymous Coward · · Score: 0

    relaxed time using WebObjects. Enough said ...

  28. there are reasons by penguin-collective · · Score: 1

    If web hosts made inline Python, Ruby and Perl modules like mod_python availible to their users, few people would choose PHP over those three.

    I disagree: I think all three of those languages and runtimes have significant disadvantages compared to PHP for web applications. In fact, mod_python and mod_perl are old enough that if they were the best choice, they'd be more widely used.