Getting titles from an array of IDs

You can make use of ids in $actor the following way to get the actor’s title.

$args = array(
    'post_type' => 'actors',
    'post__in'  => $actors,
);

$actors_posts = new WP_Query( $args );

if( $actors_posts->have_posts() ) :
    while( $actors_posts->have_posts() ) : 
        $actors_posts->the_post();
    ?>
        <h2><?php the_title() ?></h2>
    <?php endwhile; else: ?>
        echo 'Oops, there are no posts.';
<?php endif; ?>

error code: 523