Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

each() Has Been Removed

The each() function has been deprecated in PHP 7.x, and removed in PHP 8.0. Use foreach() instead.

PHP code

<?php

$array = ['a' => 1];
list($a, $b) = each($array);

echo $a; 
echo $b;

?>

Before

PHP Deprecated:  The each() function is deprecated. This message will be suppressed on further calls

Deprecated: The each() function is deprecated. This message will be suppressed on further calls
a1

After

PHP Fatal error:  Uncaught Error: Call to undefined function each()

Fatal error: Uncaught Error: Call to undefined function each()

PHP version change

This behavior changed in 8.0.

Error Messages

Extension

Analyzer

© 2023-2026, Damien Seguy - Exakat