It seems that the index value goes incrementing and we add/remove instances of the widget.
To make sure the correct data is grabbed, I can only think of checking inside the widget data itself through some control variable, something like:
Array (
[2] => Array (
Accessing widget information => asian kung-fu generation
Accessing widget information => awesome band
[var-of-control] => true (or some other convention)
)
[_multiwidget] => 1
)
Or even by title. The following function does this checking:
add_filter( 'the_content', function(){
$res = get_option( 'widget_my_widget' );
$check = check_array_key_value( $res, 'title', 'asian kung-fu generation' );
print_r( $check );
});
function check_array_key_value( $array, $key, $val )
{
foreach ( $array as $item )
{
if ( isset( $item[$key] ) && $item[$key] == $val)
return $item;
}
return false;
}