Upgrading to php 8.1 breaks some each code

Viewed 24

I have some code...

while (list($key, $val) = @each($_POST)) { $val = addslashes($val); $GLOBALS[$key] = $val; }
while (list($key, $val) = @each($_GET)) { $val = addslashes($val); $GLOBALS[$key] = $val; }

On upgrading to 8.1 it causes the following error...

 PHP Fatal error:  Uncaught Error: Call to undefined function each() in Path to file
Stack trace:
#0 {main}
  thrown in path to file

Could anyone help me with what I need to alter please?

Thank you

0 Answers
Related