PHP 6 and What to Expect 101
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."
Re:the license (Score:1)
Re:the license (Score:2)
That was "Brokeback PHP" (Score:1)
Re:the license (Score:1)
Re:the license (Score:4, Informative)
Re:the license (Score:1)
Re:the license (Score:1)
Re:the license (Score:2)
Re:the license (Score:1)
Re:the license (Score:2)
Article (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 [slashdot.org], 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 [php.net], magic_quotes [php.net] and safe_mode [php.net] 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 [php.net]: 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 [cplusplus.com] 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
Re:Article (Score:1, Flamebait)
No it's not, quit karma whoring
Re:Article (Score:2)
Yes it is, and that was a well-formatted repost. Site won't load for me...
Mod Parent Up (Score:2)
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 wa
Re:Mod Parent Up (Score:2)
Comment removed (Score:5, Interesting)
Re:Do most users even need PHP 6? (Score:1)
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.
Re:Do most users even need PHP 6? (Score:2)
Re:Do most users even need PHP 6? (Score:4, 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, ...
Re:Do most users even need PHP 6? (Score:4, Insightful)
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.
Namespace (Score:4, Insightful)
Re:Namespace (Score:5, Informative)
Will this do?
Re:Namespace (Score:2)
Re:Namespace (Score:1)
Re:Namespace (Score:2)
http://www.php.net/~derick/meeting-notes.html#nam
Re:Namespace (Score:2)
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
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 i
woohoo! (Score:2, Funny)
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!
Re:What's the point? (Score:1)
Re:What's the point? (Score:1)
Lack of backwards compatibility (Score:5, Interesting)
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 [phpbb.com]; I'm starting to wonder if I should have focused on a more stable language like python or perl instead.
Re:Lack of backwards compatibility (Score:2)
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.
Re:Lack of backwards compatibility (Score:3, Informative)
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 r
Re:Lack of backwards compatibility (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 updat
Re: (Score:1)
Re:[OT] Re:Lack of backwards compatibility (Score:2)
I can't imagine it being called anything else which makes you think "web based implementation of Diplomacy" the moment you read the title.
Re:[OT] Re:Lack of backwards compatibility (Score:1)
Its not going to attract a bigger audience (Score:2, Insightful)
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
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 sayi
Re:Its not going to attract a bigger audience (Score:1)
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;
Re:Its not going to attract a bigger audience (Score:1)
This already happened
Re:Its not going to attract a bigger audience (Score:1)
Actually .NET is not a programming language, it's a platform. Many languages run on the .NET platform, PHP [php-compiler.net] amongst others.
PEAR documentation is terrible... (Score:2)
How about "use strict;" directive (Score:1)
Re:How about "use strict;" directive (Score:4, Interesting)
Re:How about "use strict;" directive (Score:1)
Re:How about "use strict;" directive (Score:1)
E_STRICT is ever better!
http://ca3.php.net/manual/en/ref.errorfunc.php#e-
BTW, "taint" checks would be useful too and Ruby style "Safe Levels"
Re:How about "use strict;" directive (Score:2)
set error handler/level (Score:1)
Namespacing and Unicode (Score:2)
Seriously though, apart from its popularity, is there any reason to choose PHP over the multitude of other existing solutions?
Re:Namespacing and Unicode (Score:1)
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, bu
Re:Namespacing and Unicode (Score:2)
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
Re:Namespacing and Unicode (Score:2)
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
Re:Namespacing and Unicode (Score:2)
Re:Namespacing and Unicode (Score:1)
GOTO? (Score:2, Insightful)
Re:GOTO? (Score:1)
Perhaps you should try RTFA (yeah, yeah, this is slashdot, blah blah...) From http://www.php.net/~derick/meeting-notes.html#addi ng-goto [php.net]
Re:GOTO? (Score:1)
Re:GOTO? (Score:2)
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 str
Re:GOTO? (Score:2)
Re:GOTO? (Score:1)
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?
PHP needs serious redesigns (Score:5, Insightful)
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.
Re:PHP needs serious redesigns (Score:1)
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.
Re:PHP needs serious redesigns (Score:2)
You mean we could do something like this?
Wouldn't that be neat? This is a
Re:PHP needs serious redesigns (Score:1)
Re:PHP needs serious redesigns (Score:2)
Re:PHP needs serious redesigns (Score:1)
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, $ c
Comment removed (Score:3, Interesting)
Re:Web hosts should be offering more choice (Score:2)
PSP web browser reading a PSP page with PSP images (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 [pineight.com], a clone of a PlayStation Portable flagship title, puts it: "Where I come from, PSP is still Corel Paint Shop Pro."
Re:Web hosts should be offering more choice (Score:2, Interesting)
Re:Web hosts should be offering more choice (Score:2)
there are reasons (Score:2)
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.
Alternative PHP Cache (Score:2)
Re:Alternative PHP Cache (Score:2)
Jeeez... (Score:1)
One thing I'm really
a better thing could be .... (Score:1)
Re:a better thing could be .... (Score:2)
PHP's biggest problem (Score:4, Informative)
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.
Re:PHP's biggest problem (Score:3, Informative)
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.
Re:PHP's biggest problem (Score:2)
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.
Argh, WAMP (Score:1)
Re: (Score:2)