- Monday, 2015-12-07 11:40
- We, the Wikidata team and MediaWiki in general, are looking forward to upgrade our minimum system requirement from PHP 5.3 to PHP 5.5. This was and is discussed for quite some time now, and will probably take some more time. But it feels we are getting closer, and I realized I have no idea what the step from 5.3 to 5.5 actually means. Just recently I learned there is
yield, today I learned there is a
::classsyntax, but what do they do? Time to look at what's new in PHP 5.5.
- Short array syntax with
square brackets instead of
- Closures finally support
( new Class() )->method().
- Binary numbers, e.g.
0b1000, just like in Java 7.
register_globalsand magic quotes are removed. Wow. This is incredible. A good thing, but still incredible when you realized these two features are the main reason PHP was created in the first place.
SELFis recognized in uppercase. I wonder why. They use
SELF::CONSTANTas an example, but what's wrong with
- These extremely weird logo GUIDs are finally killed, including
- Generators. Use a function in a
yieldin the function to return the elements for the loop. Magic.
- try-catch also supports
finally. Wow, finally.
- One can use
foreach ( $twoDimensionalArray as list ( $a, $b ) ).
- You can use functions in
[1, 2, 3], obviously not very useful in production, but really nice when debugging and testing. Do not confuse this with
$string, which is supported since basically forever.
::classreturns the full qualified class name. Extremely useful in PHPUnit's
Kommentare zu diesem Beitrag können per E-Mail an den Autor gesandt werden.