The split () function is deprecated, preg_split (): no endimimiter ',' found

I have a PHP script written 10 years ago. Now we have moved the script to a new server and it doesn't work. The line that has the problem:

$p_industry = split(',', $member['p_industry']);

      

The recipient receives the error message:

The split () function has been deprecated.

I researched this site and then I replaced the script with

$p_industry = preg_split(',', $member['p_industry']);

      

Then the test email will receive this different error message:

preg_split (): Without trailing separator ',' found

When I change the script to

$p_industry = explode(',', $member['p_industry']);

      

I have not received an error message. But the script doesn't work either. It doesn't seem to work in such a way that it doesn't even send an error message to check the email.

What should I change to script? Can you give me a specific answer?

+3


source to share


1 answer


Preg_*

functions must have delimiters around the template. I am using ~

.



$p_industry = preg_split('~,~', $member['p_industry']);

      

+7


source







All Articles