PHP removes deprecated functions in major version bumps — the PHP 5.x to 7.x transition removed over 70 functions, and PHP 8.0 and 8.1 removed or deprecated many more. Each entry below shows the old function, the reason it was removed, and the modern replacement with a copy-paste code snippet.

Deprecated Functions

DeprecatedDescriptionReplacement
create_function()Deprecated in PHP 7.2 — creates a function from a string at runtimeUse anonymous functions (closures) with function() {} syntax
each()Removed in PHP 8.0 — iterates array with internal pointerReplace with foreach, key(), and current()
ereg()Removed in PHP 7.0 — POSIX regex matchingReplace with preg_match() using PCRE regex syntax
mysql_*Removed in PHP 7.0 — the entire mysql extensionMigrate to mysqli_* functions or PDO with prepared statements
split()Removed in PHP 7.0 — splits a string by a regex or delimiterReplace with explode() for delimiter splits, or preg_split() for regex

Quick Check

// Enable deprecation warnings in development
error_reporting(E_ALL);
ini_set('display_errors', 1);