My problem is, i have a 2D Array
and i want to override
the value of an element that was set.
My code is as follows:
$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);
In the code for the value of $indes
i would like to change from -1 to 2
and the reminder array value must remain as "-1
". How can i achieve this?