Edit: And if for some reason implode () is still problematic.
$organizers = array_unique($organizers); $neworganizers = ""; for($i = 0; $i < sizeof($organizers); $i++) { $neworganizers .= $organizers[$i]; if($i != sizeof($organizers) - 1) { $neworganizers .= ", "; } }
// $ neworganizers is now equivalent to what .implode () should return when calling $ organizers
$organizers = array(); $organizers[0] = "value1"; $organizers[1] = "value2"; $organizers[2] = "value3"; $organizers[3] = "value3"; $organizers = array_unique($organizers); // strips out last index $organizers = implode(', ', $organizers); // returns string of "value1, value2, value3" echo $organizers;
It seemed to work on writecodeline.com/php/
I also had problems with old php assemblies when I tried to explode / explode with a string with special characters in it and they were encapsulated with single quotes. I know this sounds crazy, but double quotes may be required on some servers.
Link: personal experience on old server servers.
source share