我从具有 101 个键的查询中构建了一个多维数组
当我在某个 foreach 循环之前回显 $result['q101'] 时,它会显示正确的数据..
在这个循环之后,数组以某种方式修改为 $result['q101'] => 8...???
注意:无论数字如何,这都会发生在最后一个键上。
> [q99] => Array
> (
> [name] => Disentanglement from Love Relationship
> [abbr] => DfLR
> [type] => Ascending
> [response] => Sometimes
> [score] => 3
> )
>
> [q100] => Array
> (
> [name] => Feelings of Self Worth
> [abbr] => FoSW
> [type] => Ascending
> [response] => Almost Always
> [score] => 1
> )
>
> [q101] => 8 /// WTF is this..??
下面是罪魁祸首..如果我删除这个一切都是笨拙的多莉。
foreach ($result as $key => $val){
$response_table .= '<tr><td>'.str_replace('q', '', $key).'</td><td>'.$val['response'].'</td><td>'.$val['abbr'].'</td><td>'.$val['type'].'</td><td>'.$val['score'].'</td></tr>';
$min[$val['abbr']] += 1;
$max[$val['abbr']] += 1;
}