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

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

Location:
branches/version-2_12-dev/data/class/helper
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/helper/SC_Helper_CSV.php

    r21927 r21935  
    277277        } 
    278278 
    279         foreach (array_keys($fields) as $key) { 
     279        foreach ($fields as $key => $value) { 
    280280            $field =& $fields[$key]; 
    281281 
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Mail.php

    r21927 r21935  
    137137        $objQuery->setOrder('shipping_id'); 
    138138        $arrRet = $objQuery->select('*', 'dtb_shipping', 'order_id = ?', array($order_id)); 
    139         foreach (array_keys($arrRet) as $key) { 
     139        foreach ($arrRet as $key => $value) { 
    140140            $objQuery->setOrder('shipping_id'); 
    141141            $arrItems = $objQuery->select('*', 'dtb_shipment_item', 'order_id = ? AND shipping_id = ?', 
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Mobile.php

    r21927 r21935  
    9696    function lfMobileConvertInputValue(&$value) { 
    9797        if (is_array($value)) { 
    98             foreach (array_keys($value) as $key) { 
     98            foreach ($value as $key => $val) { 
    9999                $this->lfMobileConvertInputValue($value[$key]); 
    100100            } 
  • branches/version-2_12-dev/data/class/helper/SC_Helper_PageLayout.php

    r21927 r21935  
    7575        $arrBlocs = $objPlugin->getEnableBlocs($arrBlocs); 
    7676        // php_path, tpl_path が存在するものを, 各ターゲットに配置 
    77         foreach (array_keys($arrTarget) as $target_id) { 
     77        foreach ($arrTarget as $target_id => $value) { 
    7878            foreach ($arrBlocs as $arrBloc) { 
    7979                if ($arrBloc['target_id'] != $target_id) { 
     
    324324     */ 
    325325    function setBlocPathTo($device_type_id = DEVICE_TYPE_PC, &$arrBlocs = array()) { 
    326         foreach (array_keys($arrBlocs) as $key) { 
     326        foreach ($arrBlocs as $key => $value) { 
    327327            $arrBloc =& $arrBlocs[$key]; 
    328328            $arrBloc['php_path'] = SC_Utils_Ex::isBlank($arrBloc['php_path']) ? '' : HTML_REALDIR . $arrBloc['php_path']; 
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php

    r21927 r21935  
    317317    function clearShipmentItemTemp($shipping_id = null) { 
    318318        if (is_null($shipping_id)) { 
    319             foreach (array_keys($_SESSION['shipping']) as $key) { 
     319            foreach ($_SESSION['shipping'] as $key => $value) { 
    320320                $this->clearShipmentItemTemp($key); 
    321321            } 
     
    10361036     */ 
    10371037    function setDownloadableFlgTo(&$arrOrderDetail) { 
    1038         foreach (array_keys($arrOrderDetail) as $key) { 
     1038        foreach ($arrOrderDetail as $key => $value) { 
    10391039            // 販売価格が 0 円 
    10401040            if ($arrOrderDetail[$key]['price'] == '0') { 
     
    10721072 
    10731073        if ($has_items) { 
    1074             foreach (array_keys($arrResults) as $shipping_id) { 
     1074            foreach ($arrResults as $shipping_id => $value) { 
    10751075                $arrResults[$shipping_id]['shipment_item'] 
    10761076                        =& $this->getShipmentItems($order_id, $shipping_id); 
Note: See TracChangeset for help on using the changeset viewer.