- var_dump: documentation ( source)
<?php
// works correctly
$hash = (object) [
'a' => 1,
'b' => 2,
'c' => 3,
];
foreach ($hash as $key => $value) {
var_dump($key);
unset($hash->$key);
}
echo "\n";
// BUG: skips item 'b'
$hash = (object) [
'a' => 1,
'b' => 2,
'c' => 3,
];
$it = new ArrayIterator($hash);
foreach ($it as $key => $value) {
var_dump($key);
unset($hash->$key);
}