TP5.1查詢二維數組中某個鍵值的全部和

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

  

$course_arr 是從數據庫中查詢的多條數據;
現目的是算出 多條數據中 money字段的總和;
最終:$course_money 就是最終的總和!
相關文章
相關標籤/搜索