PHP5 Just Around the Corner
HitByASquirrel writes "Just doing the rounds and I found that Zend has released PHP 5.0 Beta 4: 'This fourth beta of PHP 5 is also scheduled to be the last one (barring unexpected surprises, that did occur with beta 3). This beta incorporates dozens of bug fixes since Beta 3, rewritten exceptions support, improved interfaces support, new experimental SOAP support, as well as lots of other improvements, some of which are documented in the ChangeLog.' Hopefully they won't have any 'unexpected surprises' and we'll see this before summer!"
php might be a simple scripting language easy to
:
use but,
just wanted to point out
1) php has no real threading support e.g. other than
simple webscripts are impossible to create
2) using whatever wierd forking in your php scripts
still leaves you without shared variables and so on.
3) php has still very slow interface to shared memory
(shmop), which makes it even more pointless to use in
real enterprise applications even for web
4) even the new php-s oop structure is still out of date
when compared to java or c++ or even perl (where are
protected variables and callbacks? why does the php still
not have a normal automatic class searching system and
still relies on user own written inclusion lines? etc.)
5) php developers are heartlessy disgarding every kind of
backward compatibility with every new minor version they
write, e.g. your old scripts which worked finely for 4-5
months may be buggy without you even knowing it after 1
mysterious update.
just wanted to make this statement. php has still a long
way to go to make it to the real enterprise market where
perl and java are already ready. the new version of php
doesn't include any major necessary components to achieve
the raise to real enterprise developement market.
still hope they will make the jump to real applications
cause the idea of php is quite good. only the
implementation needs be improved. php6 maybe ?
I'd tell you the chances of this story being a dupe, but you wouldn't like it.
(From http://www.php.net/zend-engine-2.php)and
I would try and disagree with number 5 too, but I fear you have more than enough counterpoints to make it impossible for me to win.
The much-requested feature of Upload progress did not make in PHP5.0
Too bad. Now we need to wait until PHP5.1 or something.
And meanwhile stick with PHP sourcecode patch or perl method which is nightmare.
Yeah, sure, "just around the corner". That's what they said a year ago :P
Some interesting slashdot PHP5 references:
"PHP5 is well under development and a beta is expected out by March 2003 and released summer 2003"
Introduction to PHP5
General PHP5 References:
Changes in PHP 5/Zend Engine 2.0
Pidget: The PHP Widget Library
Well, for a quick and simple example, instead of writing
function f($a, $b) { return strcmp($b, $a); }
usort($array, 'f');
you could just write something like
usort($array, function ($a, $b) { return strcmp($b, $a); });
With this, functions would be first-class objects, which probably complicates the internals of the language, but it could be added when the reestructuring for improved OOP was done.
In summary, the documentation is so bad, I can't even make a decent evaluation of whether the language is any good. The *first* thing the PHP crowd needs to fix is the documentation. It ought to be rewritten from scratch.
I have experience with both PHP and perl. I have a raging bias against PHP, but I'll try to tell it straight:
PHP's a lot easier to install than mod_perl, full stop. That is to say, mod_perl might be a package install away, but configuring it to get its features working takes some work with trial and error. By being essentially an embedded evaluator first and foremost and last, PHP doesn't confuse you by dealing with apacheisms like request handler objects. Of course it doesn't confuse you with having any real general-purpose functionality either (I'm told there's actually a gtk binding, but I can't seriously consider this as more than a toy).
PHP's syntax is more regular and reduced than perl's. It has only one sigil, $foo, as opposed to $foo @foo %foo and $foo. It lacks most of the line noise constructs like $#foo. References are managed internally (though you must explicitly pass by reference to functions) so there's no difference in syntax between an array and a reference to one. PHP5 will pass objects by reference by default. PHP4 always passes a copy unless you explicitly pass by reference. I found this to be really quite a misfeature in PHP4 that I'm happy to see fixed. I certainly hope the === operator has its extremely broken semantics fixed (it does the deepest of comparisons instead of the shallowest) but I'm not holding my breath.
PHP doesn't auto-splice lists. In fact it doesn't auto-create them from the various contexts perl does, you must use the "array" function to get a list. One gets used to this, and ultimately it's not much worse than lisp's list function. Arrays are much like lua arrays, and can have numeric or string keys, there is no separate "hash" type or hash syntax to go with them.
PHP4 has no structured exception handling at all. In fact there's no mechanism whatsoever to trap many errors that simply result in a dead stop of execution, with an error message if you're lucky, otherwise no response whatsoever, more akin to a killed CGI. Older PHP4 scripts are rife with uses of automatically populated global variables that make them targets for cross-site-scripting and sql injection. Don't trust a PHP script from before 2002 or so. PHP5 is supposed to address these issues.
I've finally had it: until slashdot gets article moderation, I am not coming back.
Whoa, this is the first time I've heard the PHP documentation called "bad".. I think it's some of the best docs out there.
Also if you need a good learning tool for PHP, try the O'Reilly PHP cookbook. It's a wonderful book, very clearly and thoroughly written. No preaching or "my language is better than yours" crap, just good advice from a couple guys who use PHP to get work done.
Besides, if you know Java, PHP5 is pretty much a no-brainer.
usort($array, create_function('$a,$b', 'return strcmp($b, $a);');
Which is relatively close.