TP5.1查询二维数组中某个键值的所有和

        $course_money=0;
        foreach($course_arr as $key => $v){
            $course_money= $course_money + $v->money;
        }

  

$course_arr 是从数据库中查询的多条数据;
现目的是算出 多条数据中 money字段的总和;
最终:$course_money 就是最终的总和!
posted @ 2019-06-06 14:56  微联云  阅读(2034)  评论(0编辑  收藏  举报