skip to Main Content

I have some code that used to work fine on a previous version of PHP but is throwing some errors now that I’m in a new hosting environment.
The error reads:

Warning: explode() expects at least 2 parameters, 1 given in
/check-inbox.php on line 6

$list = explode(trim(str_replace(" ",'',$meta['adv_email'])));

The script is supposed to send out an email later on in the file but it can’t extract the receivers address because of this error. I’m not sure what parameters to add in there to make it function on PHP 7.2. Could some one please guide me on how to fix this?

2

Answers


  1. Explode requires two parameters, the first being the delimiter, the second being the string to split into an array.

    If your $meta['adv_email'] variable contains a list of emails separated by a comma, then you would pass ‘,’ as the first parameter since the comma is the delimiter like so:

    $list = explode(',', trim(str_replace(" ",'',$meta['adv_email'])));

    Login or Signup to reply.
  2. Sorry for bumping this topic but did you finished it to get it all working?

    I know what script you are talking about and i have the same error..

    even with: $list = explode(‘,’, trim(str_replace(" ",”,$meta[‘adv_email’]))); it will not work… well.. maybe the line will work but the mail is not sending..

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search