Sitemap

Member-only story

Stop using these outdated PHP functions in PHP 8 (and what to use instead)

Your quick-start guide for modernising legacy code on PHP 8.0 → 8.4

3 min readMay 22, 2025
Photo by Kvalifik on Unsplash

Why this matters

PHP 8 finally draws the line under a lot of baggage from the language’s early days. Functions that were merely deprecated in 7.x now disappear entirely or trigger fatal errors; others have been put on an official countdown clock for removal in PHP 9. If you maintain an older code-base, upgrading means hunting these dinosaurs down and replacing them before they bite you in production.

Below is a curated list of the “usual suspects” Medium readers are still likely to meet in 2025, plus drop-in modern alternatives. Paste the checklist into your next refactor sprint and thank yourself later.

🔓 Not a Medium member yet? Click here to access this article for FREE!

1. mysql_* (the entire extension)

  • Status: Removed since PHP 7.0, obviously absent in PHP 8.
  • Why it had to go: Non-prepared queries, no Unicode, no SSL, no future.
  • Modern fix: PDO (PDO, PDOStatement) or MySQLi (mysqli_query(), parameterised prepare() + bind_param()); both support prepared statements and typed errors.

--

--

Roman Huliak
Roman Huliak

Written by Roman Huliak

Full Stack Developer with 15 years of experience in ERP systems, skilled in leadership, analysis, and end-to-end development.

Responses (2)