You have to parse the full array and check keys are inside the required bounds:
foreach( $theArray as $key => $value )
{
if( $key >= 'r' && $key < 's' )
{
// will enter here with keys 'r' and 'v'
$theArray[ $key ] = $theNewValue
}
}
This assuming you want to catch all the values with keys that are alphabetically between "r" and "s" ("s" excluded).
This is not completely clear from your question.
Instead if you want to catch the values between "r" and "s" according to the array order then the codes changes slightly:
$update = false
foreach( $theArray as $key => $value )
{
if( $key == 'r' )
{
$update = true;
}
elseif( $key == 's' )
{
break;
}
if( $update )
{
// will enter here with keys 'r' and 'v'
$theArray[ $key ] = $theNewValue
}
}