I have a problem on replacing a value in array with exact given index. To be exact, I'd like to replace a string in array[2] with a new number but I don't have an idea. So please have a look on my resources :
pos:0 //position of index in array
id:498 //id of a field
new:6300 //new value to replace in an array
cost:6200-5200-4600-5600-4100 //the array
From above, I'd like to replace a string indexes "0" in "cost" with a new string from "new" so the expected result should be :
6300-5200-4600-5600-4100
I tried to search for everywhere but there's nothing return but array_search - which is not what i'm looking for. Please advise.
$array[$index] = $newvalue;