为什么以下代码会显示此错误?
Xdebug:致命错误:不支持的操作数类型 C:\ WAMP \ WWW \ WordPress的\可湿性粉剂内容\主题\ testtheme \单football_league.php 在第63行。
foreach (array_keys($team_points + $team_points2) as $key) {
$total_points_final[$key] = (isset($team_points[$key]) ? $team_points[$key] : 0) + (isset($team_points2[$key]) ? $team_points2[$key] : 0);
}
答案 0 :(得分:0)
您是要尝试连接$ team_points和$ team_points2吗?如果是这样,您应该使用array_merge:http://php.net/manual/en/function.array-merge.php
foreach (array_keys( array_merge($team_points, $team_points2)) as $key) {
$total_points_final[$key] = (isset($team_points[$key]) ? $team_points[$key] : 0) + (isset($team_points2[$key]) ? $team_points2[$key] : 0);
}