lukecolli98 lukecolli98 - 1 month ago 9
HTML Question

Function split() is deprecated PHP, explode doesn't work

I have downloaded a contact form form the web. On one part (

class.phpmailer.php
) on line 470 it uses:

$toArr = split(',', $to);


Of course this is depreciated. I have searched the web for answers (and read the php syntax), and it says use
explode()
or
preg_split()
.

I have tried both of these, but when I submit the contact form nothing happens. The data stays but the captcha changes. I also put:

$toArr = split('!,!', $to);


Again, the form would not submit.

Could somebody please tell me how to fix this ?

EDIT:
The error was nothing to do with explode/preg_split - it was a missing html tag I believe.

Answer Source

You can use explode without problems:

$toArr = explode ( ',', $to );

Or you can use: preg_split() or str_split() or