update : 2015.11.03
php.shukuma.com검색:
|
New featuresGenerators addedSupport for generators has been added via the yield keyword. Generators provide an easy way to implement simple iterators without the overhead or complexity of implementing a class that implements the Iterator interface. A simple example that reimplements the range() function as a generator (at least for positive step values):
<?php 위 예제의 출력: Single digit odd numbers: 1 3 5 7 9 finally keyword addedtry-catch blocks now support a finally block for code that should be run regardless of whether an exception has been thrown or not. New password hashing APIA new password hashing API that makes it easier to securely hash and manage passwords using the same underlying library as crypt() in PHP has been added. See the documentation for password_hash() for more detail. foreach now supports list()The foreach control structure now supports unpacking nested arrays into separate variables via the list() construct. For example:
<?php 위 예제의 출력: A: 1; B: 2 A: 3; B: 4 Further documentation is available on the foreach manual page. empty() supports arbitrary expressionsPassing an arbitrary expression instead of a variable to empty() is now supported. For example:
<?php 위 예제의 출력: This will be printed. array and string literal dereferencingArray and string literals can now be dereferenced directly to access individual elements and characters:
<?php 위 예제의 출력: Array dereferencing: 1 String dereferencing: P Class name resolution via ::classIt is possible to use ClassName::class to get a fully qualified name of class ClassName. For example:
<?php 위 예제의 출력: Name\Space\ClassName OPcache extension addedThe Zend Optimiser+ opcode cache has been added to PHP as the new OPcache extension. OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. See the installation instructions for more detail on enabling and using OPcache. foreach now supports non-scalar keysforeach now supports keys of any type. While non-scalar keys cannot occur in native PHP arrays, it is possible for Iterator::key() to return a value of any type, and this will now be handled correctly. Apache 2.4 handler supported on WindowsThe Apache 2.4 handler SAPI is now supported on Windows. Improvements to GDVarious improvements have been made to the GD extension, these include:
|