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

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

Location:
branches/version-2_12-dev/data/class/pages/admin
Files:
4 edited

Legend:

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

    r21870 r21935  
    784784        $exists = false; 
    785785        $arrExistsProductClassIds = $objFormParam->getValue('product_class_id'); 
    786         foreach (array_keys($arrExistsProductClassIds) as $key) { 
     786        foreach ($arrExistsProductClassIds as $key => $value) { 
    787787            $exists_product_class_id = $arrExistsProductClassIds[$key]; 
    788788            if ($exists_product_class_id == $product_class_id) { 
  • branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php

    r21894 r21935  
    497497        $select_recommend_id = $arrForm['recommend_id' . $select_recommend_no]; 
    498498 
    499         foreach (array_keys($arrForm) as $key) { 
     499        foreach ($arrForm as $key => $value) { 
    500500            if (preg_match('/^recommend_id/', $key)) { 
    501501                if ($select_recommend_no == preg_replace('/^recommend_id/', '', $key)) { 
  • branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Bkup.php

    r21924 r21935  
    450450                } 
    451451                unset($row); 
    452                 foreach (array_keys($ret) as $key) { 
     452                foreach ($ret as $key => $value) { 
    453453                    if ($ret[$key]['bkup_name'] == $bkup_name) { 
    454454                        $row =& $ret[$key]; 
  • 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.