S
S
Skrolea2017-04-12 14:29:57
PHP
Skrolea, 2017-04-12 14:29:57

What does the Ereg() function do?

I got a staaary site on Bitrix. The component that displays (forms) the news has a line

if(strlen($arParams["FILTER_NAME"])<=0 || !ereg("^[A-Za-z_][A-Za-z01-9_]*$", $arParams["FILTER_NAME"]))
{
  $arrFilter = array();
}

Naturally, the modern version of php does not even know the ereg function (in 5.3 it became depricated, in 7 it is not at all). I replaced it one by one with
if(strlen($arParams["FILTER_NAME"])<=0 || !preg_match("^[A-Za-z_][A-Za-z01-9_]*$", $arParams["FILTER_NAME"]))
{
  $arrFilter = array();
}

The component works, but displays completely different news. What does this function actually do and how to replace it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2017-04-12
@GavriKos

www.php.net/ereg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question