christiaanbye/polyfill-each

PHP 8.x polyfill for the removed each() function

Maintainers

Package info

github.com/ChristiaanBye/polyfill-each

pkg:composer/christiaanbye/polyfill-each

Statistics

Installs: 20 275

Dependents: 1

Suggesters: 0

Stars: 5

Open Issues: 0

1.0.1 2023-08-20 17:47 UTC

This package is auto-updated.

Last update: 2026-02-21 14:24:11 UTC


README

This package returns the legacy each() function which has been removed in PHP 8.0. This can be useful when working with legacy code or with end-of-life packages which still make use of the each() function.

It is therefore not really a polyfill but rather a shim as it provides legacy functionality to modern-day software instead of vice versa. I have still chosen the name polyfill as this term is usually top of mind irrespective of the direction of the port.

Prerequisites

  • PHP 5.3 or later, though the shim will only take effect in PHP 8.x

Installation

Installation can be easily done using Composer:

composer require christiaanbye/polyfill-each