https://www.vultr.com

The Everywhere Cloud

Deploy an instance.
Accelerate your application.


Replacing ereg() with preg_match() in PHP


After upgrading PHP, some scripts such as those used in old Drupal systems may report the fatal error "undefined function ereg()" due to the function's deprecation and removal. Simply replace it with preg_match() to solve the problem.

==========

1. Find the ereg() function.

ereg($pattern, $subject, $matches);

2. Convert it to the preg_match() function as shown.

preg_match("/".$pattern."/", $subject, $matches);

==========

Comments

Popular posts from this blog

Enabling HTTPS in Home Assistant

Configuring the FreeBSD Firewall with IPFW

Running Home Assistant on FreeBSD Servers