//go through each question
foreach($file_data as $value) {
//separate the string by pipes and place in variables
list($category, $question) = explode('|', $value);
//place in assoc array
$data = array($category => $question);
print_r($data);
}
Dies funktioniert nicht, da es den Wert von Daten ersetzt. Wie kann ich dafür sorgen, dass jeder Schleife ein assoziativer Wert hinzugefügt wird? $file_dataist ein Array von Daten mit einer dynamischen Größe.