Fatal error: Missed error: call to undefined function ereg_replace () PHP 7

below code gives me fatal error in php 7

    $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']));

is there any way to make it compatible with php 7?

+4
source share
2 answers

Go to preg_replace Documents and update the expression to use the preg syntax (PCRE) instead of the ereg (POSIX) syntax where there are Docs differences (same as the manual for Documents says ). ereg_replace

Your above code should be like this:

$jquery_click_hook = preg_replace("[^A-Za-z0-9]", "", strtolower($value['name']));
+11
source

ereg_replace DEPRECATED PHP 5.3.0 PHP 7.0.0. , preg_replace() ereg_replace()

+4

Source: https://habr.com/ru/post/1654452/


All Articles