diff options
author | Alex Dowad <alexinbeijing@gmail.com> | 2020-05-11 20:32:13 +0200 |
---|---|---|
committer | Alex Dowad <alexinbeijing@gmail.com> | 2020-09-23 08:33:24 +0200 |
commit | 4222ae16e7848e0b3f062a9a989d387de307a7af (patch) | |
tree | 049e87edb7c167065cf8399943323d4451dc69cd /configure.ac | |
parent | 1e9db80d7264911fa4089cb7e4b3dc7f97b19c6e (diff) | |
download | php-git-4222ae16e7848e0b3f062a9a989d387de307a7af.tar.gz |
SplFixedArray is Aggregate, not Iterable
One strange feature of SplFixedArray was that it could not be used in nested foreach
loops. If one did so, the inner loop would overwrite the iteration state of the outer
loop.
To illustrate:
$spl = SplFixedArray::fromArray([0, 1]);
foreach ($spl as $a) {
foreach ($spl as $b) {
echo "$a $b";
}
}
Would only print two lines:
0 0
0 1
Use the new InternalIterator feature which was introduced in ff19ec2df3 to convert
SplFixedArray to an Aggregate rather than Iterable. As a bonus, we get to trim down
some ugly code! Yay!
Diffstat (limited to 'configure.ac')
0 files changed, 0 insertions, 0 deletions