hello i have an array like this and i want to change the area key to info1 like $values ["Area"]
will become $values ["info1"]
,$values ["Shop"]
should be $values ["info2"]
and so on but evertime I run my code it throws errormessages like "undefined index" but I really dont know why.
$values ["standort"] = "60071-00001";
$values ["desc"] = "car";
$values ["street"] = "first ave";
$values ["number"] = "98";
$values ["postcode"] = "40764";
$values ["city"] = "London";
$values ["Area"] = "15";
$values ["Shop"] = "430";
$values ["SalesArea"] = "1998";
$values ["info4"] = "";
$values ["info5"] = "";
// echo var_dump(array_keys($values));
for($i=6;$i<=10;$i++){
$j= array_keys($values)[$i];
if($i==6){
$values["info1"]=$values[$j];
unset($values[$j]);
}
if($i==7){
$values["info2"]=$values[$j];
unset($values[$j]);
}
if($i==8){
$values["info3"]=$values[$j];
unset($values[$j]);
}
if($i==9){
$values["info4"]=$values[$j];
unset($values[$j]);
}
if($i==10){
$values["info5"]=$values[$j];
unset($values[$j]);
}
}