Fame and honor to GB. Danke für eine angepasste trimExplode Funktion.
/**
* Helferfunktion zum Trimmen und Exploden
* @param string $delimiter
* @param string $string
* @param bool $removeEmpty
* @return array
*/
public function trimExplode($delimiter, $string, $removeEmpty = false){
$explodedValues = explode($delimiter, $string);
$result = array_map('trim', $explodedValues);
if ($removeEmpty) {
$temp = array();
foreach ($result as $value) {
if ($value !== '') {
$temp[] = $value;
}
}
$result = $temp;
}
return $result;
}