�µ�����

���� Generators

Support 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
function xrange($start$limit$step 1) {
    for (
$i $start$i <= $limit$i += $step) {
        yield 
$i;
    }
}

echo 
'Single digit odd numbers: ';

/* ע�Ᵽ�����ڴ��е���������ᱻ�����򷵻� */ 
foreach (xrange(192) as $number) {
    echo 
"$number ";
}
?>

�������̻������

Single digit odd numbers: 1 3 5 7 9 

���� finally �ؼ���

try-catch blocks now support a finally block for code that should be run regardless of whether an exception has been thrown or not.

foreach ����֧�� list()

foreach ���ƽṹ����֧��ͨ�� list() ���콫Ƕ��������뵽�����ı��������磺

<?php
$array 
= [
    [
12],
    [
34],
];

foreach (
$array as list($a$b)) {
    echo 
"A: $a; B: $b\n";
}
?>

�������̻������

A: 1; B: 2
A: 3; B: 4

���� foreach ��������ĵ��ɲο�����ֲ�ҳ�档

empty() ֧��������ʽ

empty() ����֧�ִ���һ��������ʽ����������һ�����������磺

<?php
function always_false() {
    return 
false;
}

if (empty(
always_false())) {
    echo 
'This will be printed.';
}

if (empty(
true)) {
    echo 
'This will not be printed.';
}
?>

�������̻������

This will be printed.

array and string literal dereferencing

Array and string literals can now be dereferenced directly to access individual elements and characters:

<?php
echo 'Array dereferencing: ';
echo [
123][0];
echo 
"\n";

echo 
'String dereferencing: ';
echo 
'PHP'[0];
echo 
"\n";
?>

�������̻������

Array dereferencing: 1
String dereferencing: P

�µ������ϣ API

A �µ������ϣ 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.

Apache 2.4 handler supported on Windows

The Apache 2.4 handler SAPI is now supported on Windows.

�Ľ� GD

�� GD ��չ���˶෽��ĸĽ���������