Instead of exploding on "; " (with the space), you might want to explode on only the “;” and the get rid of any whitespace separately.
$names = array_map(‘trim’, $alreadyExplodedArray);
Advantage is that it works no matter much many spaces or whitespace is before/after the “;”.