This is the old code that is now null and void due to the each function no longer working in PHP version 8:
case pdf_parser::TYPE_DICTIONARY:
// A dictionary.
$this->_straightOut('<<');
reset ($value[1]);
while (list($k, $v) = each($value[1])) {
$this->_straightOut($k . ' ');
$this->_writeValue($v);
}
$this->_straightOut('>>');
break;
I need to convert the each statement to "foreach" and I tried the following:
foreach ($k as $v => $value[1]) {
Nothing works! Please if you can rewrite my code above so it works with the foreach statement. I have tried everything :(
CodePudding user response:
Just transform the deprecated each to
foreach($value[1] as $k => $v) {
$this->_straightOut($k . ' ');
$this->_writeValue($v);
}