Also it is faster and much better on memory consumption (depends on app of course, but 10-20% speedup and 20-30% less peak memory have been observed on some mainstream apps).
The www.php.net mirror will only be rsynced tomorrow, for now use http://docs.php.net/manual/en/migration54.php instead to get infos about 5.4 features. It's a good bit more up to date.
Really looking forward to traits. We have some hacks using interfaces and __call that we have been using to try and approximate traits, but the real thing is always much better. :)
This is a nice list of improvements. As someone who spends a lot of the day in PHP-land, this is going to make me happy. As someone who also controls our entire server stack, waiting for someone else to decide to upgrade will not be a problem :)
I'm glad the PHP devs are starting to actually make it a "real" language. It seems like PHP has always been the fat kid bumbling along behind everyone shouting "wait up guys!!" With closures in 5.3, syntax improvements and removal of horrible features (register_globals, magic_quotes, etc) in 5.4, it's shaping up quite nicely.
They also improved the zend engine, CURL extension, added Tokyo cabinet abstract and Berkeley DB Support! Added a couple of hashes, Improved JSON Extension (JSON_NUMERIC_CHECK!) and a whole lot of bug fixes. The UTF-8 part was long overdue, glad they fixed that.
I spend a lot of time programming in PHP. Its reputation is pretty bad, but updates like this keep me going!
Seems like the multiyear unit-test coverage campaign is starting to pay off for the core PHP engineers, 5-6 years ago they swore they couldn't do shortened array syntax without major problems.
"Arrays cast from SimpleXMLElement now always contain all nodes instead of just the first matching node. All SimpleXMLElement children are now always printed when using var_dump(), var_export() and print_r()."
I'm glad to see the short array syntax. Having strayed from PHP for a while to work on Ruby and JavaScript I'm really enjoying the ability to leave out semicolons in unambiguous end-of-line situations. Would love to see that make it into PHP at some point.
The best part of short array syntax is that now you don't need named parameters to be supported by the language.
function foo($opts) {
echo $opts['source'] . $opts['destination'];
}
// just one extra pair of [] needed instead of new array()
foo(['source' => '/123', 'destination' => '/abc']);
Isn't that a bit like leaving a loaded handgun laying around? It's unambiguous today, but what if someone else starts working with your code and it's no longer unambiguous?
These features can only be good for PHP. Now the community needs to step up and care for the language better. We have seen the popularity of many languages and frameworks rise and fall, but php keeps chugging along. Modern frameworks are awesome, but the community is still rather fractured. I would love to see people more proud of php, to get over the fads around them. Now the language is getting some nice features, I think it's our time to shine :)
When will this be available for FreeBSD? I really can't wait for traits, short array syntax and "foo()[0]". This is really a nice upgrade. Good job PHP team!
There are some around like http://news.php.net/php.internals/57760, seen a couple more but forget where. The trend does seem to be towards far better performance across the board though which is good.
Zend Technologies Ltd. is a company started by Zeev Suraski and Andi Gutmans. The product of theirs you most likely heard of is Zend Framework, a PHP framework. It's however not their only product. Another one is the Zend Engine, which is a PHP interpeter and the virtual machine at the heart of PHP and the reason there are references to Zend all over the place.
Zend developed the Zend Engine, a virtual machine. PHP4 is based on the Zend engine. Zend is more than just the framework, it literally is the core of PHP.
[+] [-] randomdrake|14 years ago|reply
array dereferencing - $object->method()[$index] is now valid syntax
built-in webserver via CLI - php -s - http://php.net/manual/en/features.commandline.webserver.php
traits and the insteadof operator - http://php.net/language.oop5.traits.php
shortened array syntax - $array = [1, 2, [1, 2, 3], 4];
Finally removed register_globals ;)
Default charset of UTF-8!
Read all about it! http://www.php.net/manual/en/migration54.php
[+] [-] smsm42|14 years ago|reply
[+] [-] duskwuff|14 years ago|reply
They've also removed magic_quotes. A few functions that queried its status still exist, but you can't turn it on.
[+] [-] lukifer|14 years ago|reply
[+] [-] mhitza|14 years ago|reply
[+] [-] nikic|14 years ago|reply
[+] [-] shaunxcode|14 years ago|reply
funcReturnsFunc(1)(2)
[+] [-] tabbyjabby|14 years ago|reply
[+] [-] manuletroll|14 years ago|reply
[+] [-] pkulak|14 years ago|reply
[+] [-] orthecreedence|14 years ago|reply
I'm glad the PHP devs are starting to actually make it a "real" language. It seems like PHP has always been the fat kid bumbling along behind everyone shouting "wait up guys!!" With closures in 5.3, syntax improvements and removal of horrible features (register_globals, magic_quotes, etc) in 5.4, it's shaping up quite nicely.
Thanks, PHP devs!
[+] [-] Pengwin|14 years ago|reply
It is sad that a lot of servers are not like this, and PHP 5.4 will take ages to appear, if at all.
Heck, I know of a hosting company still using PHP4.
[+] [-] dirkdeman|14 years ago|reply
I spend a lot of time programming in PHP. Its reputation is pretty bad, but updates like this keep me going!
[+] [-] itmag|14 years ago|reply
Would love to get back into it now that it's a "real" language.
Got any good tips about books on modern PHP programming?
[+] [-] tlack|14 years ago|reply
[+] [-] klausa|14 years ago|reply
Also,
I have no idea how is that supposed to work. What should be the outcome on, say: What about (assuming $a is still "foo"): etc.?[+] [-] honopu|14 years ago|reply
I understand for general php portability that its better to use the <?php echo vs <?=$whatever syntax, but less code is a good thing.
[+] [-] TazeTSchnitzel|14 years ago|reply
This is good news indeed, they seem to be actually improving the language for once.
[+] [-] CptCodeMonkey|14 years ago|reply
[+] [-] sbarre|14 years ago|reply
"Arrays cast from SimpleXMLElement now always contain all nodes instead of just the first matching node. All SimpleXMLElement children are now always printed when using var_dump(), var_export() and print_r()."
[+] [-] hinathan|14 years ago|reply
[+] [-] chime|14 years ago|reply
[+] [-] dirkdeman|14 years ago|reply
[+] [-] pavel_lishin|14 years ago|reply
(edit: talking about JS only.)
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] function_seven|14 years ago|reply
> Chained string offsets - e.g. $a[0][0] where $a is a string - now work.
Can someone explain why this is? I'm sure I'm misunderstanding, but this seems to mean that the following would work:
What's the point? To avoid failure if I pass a string instead of a 2-dimensional array?[+] [-] fooyc|14 years ago|reply
[+] [-] fooyc|14 years ago|reply
[+] [-] dave1010uk|14 years ago|reply
[0] http://docs.php.net/manual/en/closure.bindto.php
[1] https://developer.mozilla.org/en/JavaScript/Reference/Global...
[+] [-] evilvoidhamster|14 years ago|reply
[+] [-] 0x0|14 years ago|reply
and the UPGRADING instructions: http://svn.php.net/viewvc/php/php-src/tags/php_5_4_0/UPGRADI...
[+] [-] mahmud|14 years ago|reply
https://bugs.php.net/bug.php?id=61095
[+] [-] greut|14 years ago|reply
[+] [-] petdance|14 years ago|reply
http://gcov.php.net/viewer.php?version=PHP_5_4
Why even bother having a test suite?
[+] [-] fruchtose|14 years ago|reply
* 82 failing tests
* 44 expected test failures
* 1119 compiler warnings
I want to believe that PHP is growing up, but I have to admit I'm not convinced.
[+] [-] llgrrl_|14 years ago|reply
http://php-fpm.org/
[+] [-] chrisguitarguy|14 years ago|reply
[+] [-] CWIZO|14 years ago|reply
[+] [-] rdoherty|14 years ago|reply
[+] [-] robryan|14 years ago|reply
[+] [-] pavelkaroukin|14 years ago|reply
[+] [-] tobiasgies|14 years ago|reply
[+] [-] dirkdeman|14 years ago|reply
[+] [-] jaequery|14 years ago|reply
finally ....
[+] [-] jaequery|14 years ago|reply
[+] [-] unknown|14 years ago|reply
[deleted]