I stored a variable i exploded into an array into a session.
$totalSlip = explode(',',$_SESSION['isSlip']);
this gives me an array of
Array (
[0] => 25$$A
[1] => 34$$D
[2] => 32$$D
)
There are 3 values that are possible e.g 25$$A, 25$$D and 25$$H. My challenge is i want the a new value to substitute the value of a key in the array when it occurs more than once. e.g if 25$$A already exist and i add 25$$D what it gives me is
Array (
[0] => 25$$A
[1] => 34$$D
[2] => 32$$D
[3] => 25$$D
)
but what i want is this
Array (
[0] => 25$$D
[1] => 34$$D
[2] => 32$$D
)
i want the value of array[0] to be replaced. I'll appreciate any help i can get, thanks.