0
我的问题是,我有一个2D Array
,我想要override
设置的元素的值。访问和覆盖2d数组值
我的代码如下:
$indes="-1";
$inupccode="-1";
$inuomcode="-1";
$instdpack="-1";
$inweight="-1";
$inlength="-1";
$inwidth="-1";
$inheight="-1";
$inunitprice="-1";
$infamcode="-1";
$basicInfo = array(array($indes,"prdes1_35", $inupccode,
"prupc#_2", $inuomcode,"prwuts_3-1",
$instdpack,"prwuns_12", $inweight,
"prgrwt_11", $inlength,"prlong_7",
$inwidth,"prwide_7", $inheight,"prhigh_7",
$inunitprice,"prprce_12", $infamcode,"proga2"));
echo "before";
print_r($basicInfo);
foreach($basicInfo as $value){
foreach ($value as $id){
if($id == "prdes1_35"){
$value = 2;
}
}
}
echo "after";
print_r($basicInfo);
在用于我想从-1 to 2
和提醒阵列值更改必须保持为“-1
”的$indes
值的代码。我怎样才能做到这一点?