Thanks for your answers. According to comments above, I modified my code. Now it works. Is it correct way?
<?php
/*
Plugin Name: Test plugin
*/
$arr = [];
add_action( 'init', 'set_var_data' );
function set_var_data() {
global $arr;
$arr = [
'val',
'val2',
'val3'
];
$arr = apply_filters( 'my_hook', $arr );
}
print_r( $arr );