作者:俊廷淑芳淑幸 | 来源:互联网 | 2023-05-17 17:43
gothrougheachquestionforeach($file_dataas$value){separatethestringbypipesandpla
//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);
}
This is not working as it replaces the value of data. How can I have it add an associative value each loop though? $file_data
is an array of data that has a dynamic size.
这并不起作用,因为它替换了数据的值。如何让它在每个循环中添加一个关联值?$file_data是一个具有动态大小的数据数组。
5 个解决方案