Page 1 of 1
PHP Fatal error: Uncaught Error: Call to undefined function each() in /
Posted: Wed Sep 17, 2025 4:10 pm
by mister_v
Got the following error for an old script:
Code: Select all
PHP Fatal error: Uncaught Error: Call to undefined function each() in /file.php
Re: PHP Fatal error: Uncaught Error: Call to undefined function each() in /
Posted: Wed Sep 17, 2025 4:22 pm
by mister_v
The script still uses statements like:
Code: Select all
while ( list ($key,$val) = each ($array) )
{
This an old way of doing things ( in PHP 6 ?)
Anyway in PHP8.1 the function each() has been removed.
I recommand replacing it with foreach()
Code: Select all
foreach($array as $key=>$val)
{
...
}
Did it in my script and now it is running properly again.