#
805471e8 |
| 08-Jun-2021 |
Nikita Popov |
Fix bug #81112: Implement JsonSerializable for SplFixedArray This returns an array for SplFixedArray JSON encoding, which is more appropriate than an object with integer string keys.
Fix bug #81112: Implement JsonSerializable for SplFixedArray This returns an array for SplFixedArray JSON encoding, which is more appropriate than an object with integer string keys. Closes GH-7117.
show more ...
|
#
4222ae16 |
| 11-May-2020 |
Alex Dowad |
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 ite
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!
show more ...
|