Ignore:
Timestamp:
2012/06/21 15:02:41 (12 years ago)
Author:
pineray
Message:

#1859
foreach でキーしか使わない場合に array_keys で配列を作ってから渡す方法だと、
メモリを倍ほど消費することがわかったので、見苦しいけれど不要なバリューを生成する方向に.
F*in' PHP!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/admin/total/LC_Page_Admin_Total.php

    r21867 r21935  
    416416            $objGraphBar = new SC_Graph_Bar(); 
    417417 
    418             foreach (array_keys($arrList) as $val) { 
    419                 $arrKey[] = mb_ereg_replace('~', '-', $val); 
     418            foreach ($arrList as $key => $value) { 
     419                $arrKey[] = mb_ereg_replace('~', '-', $key); 
    420420            } 
    421421 
     
    527527        $arrTotalResults = $objQuery->select($col, $from, $where, $arrWhereVal); 
    528528 
    529         foreach (array_keys($arrTotalResults) as $key) { 
     529        foreach ($arrTotalResults as $key => $value) { 
    530530            $arrResult =& $arrTotalResults[$key]; 
    531531            $member_key = $arrResult['order_sex']; 
     
    600600        $arrTotalResults = $objQuery->select($col, $from, $where, $arrWhereVal); 
    601601 
    602         foreach (array_keys($arrTotalResults) as $key) { 
     602        foreach ($arrTotalResults as $key => $value) { 
    603603            $arrResult =& $arrTotalResults[$key]; 
    604604            $job_key = $arrResult['job']; 
     
    637637        $arrTotalResults = $objQuery->select($col, $from, $where, $arrWhereVal); 
    638638 
    639         foreach (array_keys($arrTotalResults) as $key) { 
     639        foreach ($arrTotalResults as $key => $value) { 
    640640            $arrResult =& $arrTotalResults[$key]; 
    641641            $age_key = $arrResult['age']; 
     
    783783            // 合計の計算 
    784784            foreach ($arrResults as $arrResult) { 
    785                 foreach (array_keys($arrResult) as $value) { 
    786                     $arrTotal[$value] += $arrResult[$value]; 
     785                foreach ($arrResult as $key => $value) { 
     786                    $arrTotal[$key] += $arrResult[$key]; 
    787787                } 
    788788            } 
Note: See TracChangeset for help on using the changeset viewer.