Skip to content

ArrayHash: Unset of key in foreach at on php7 skip some items #103

@norbe

Description

@norbe
$hash = \Nette\Utils\ArrayHash::from([1 => 1, 2=> 2, 3=> 3]);
foreach($hash as $key => $value) {
    unset($hash[$key]);
}
dump($hash);

Output is:

Nette\Utils\ArrayHash #3f75
2 => 2

I'm not sure, is it bug (in php?) or it's just not supported and I'm using it wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions