I have a variable called $to. I want this variable to contain data separated by a comma like below:
$to='[email protected], [email protected]';
If there is only one email there will no comma; if there are multiple emails there will not be a comma after the last email.
implode(',', $emails).